Short answer: Not
The browser Alert is a simple DOM alert, as described in W3C "show an alert to the user and wait for it to close"; as a rule: there is no specification, although browsers may even let you customize as they do with the scrool bar: https://developer.mozilla.org/en-US/docs/Web/CSS/::-Webkit-scrollbar but this would be out of specification
How to customize (Simple alternative)
You need to make your own Alert and mimic browser behavior by javascript.
example:
Javascript:
<script>
function customAlert(message) {
var div = document.createElement("div");
div.classList.add("custom-alert");
var close = document.createElement("a");
close.textContent = "[x]";
close.classList.add("close"); // para o seu css
close.addEventListener("click", () => {
document.body.removeChild(div);
}, true);
div.appendChild(close);
div.appendChild(document.createTextNode(message));
document.body.appendChild(div);
}
customAlert("ola");
</script>
CSS
.custom-alert {
/* o css do seu alerta */
}
W3C dom Alert: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-Alert
Possible duplicate of Customizing the Alert
– Bacco
Visit the Sweet Alert. It has many uses and customisations for
alerts
.– I_like_trains
I believe the best you can do is to use sweetalert. It is a ready component, however extremely nice.
– Lucas Brogni
I’ll take a look at this Sweet Alert
– RonaldoM
I tested here, I believe it is the best option even facilitated much more my work, thanks for the tip !
– RonaldoM