How to create and apply CSS to javascript Alert

It is not possible, or else people will use it to phish.


You cannot. alert() simply shows a native message box, so it'll look however the OS makes it look.

In general, you shouldn't be using alert boxes because they are annoying and they block the entire browser.* You could always create a fake alert box with JavaScript that achieves the same effect. You could then style it however you want with normal CSS. If you use jQuery, there's SimpleModal (demos).

* Modern browsers tend to only block the window that spawned the alert, but they're still annoying and you still shouldn't use them. :)