Well, one thing you need to know is that you cannot draw up an alert window. this system object is not a CSS thing .
if you still want to use the alert and want to move the text from left to right, use \t , which is the tab. You can find out how many characters you are going to use in a string, and then wrap the text in \t s.
eg:
\t This text will be centered \t\n \t in the middle of the alert \t
This is not ideal, but it is so close to moving the text to the center in the alertBox.
\t works fine with Firefox, but not with Chrome. I love Chrome, but as a web developer this is a pain in the neck.
For your information: you can also create your own. For instance,
JQuery UI Dialog
Look here: DEMO
The best I've used these days to display messages is to use toasts. They pop up, show your message in a beautiful box, and then pop up in a smooth manner.
take a look at CSS TOAST MATERIALIZATION
source share