How to center the message inside an alert box in JavaScript? -
suppose have alert message like:
alert("message");
when command executed, alert box pops message aligned left of alert box.
is there way center message inside alert box?
well, 1 thing should know can't style alert box. it's system object not css thing.
if still want use alert , want move text left right use \t
, tab. can figure out how many characters you're going use on line , encase text in \t
s.
eg:
\t text centered \t\n \t in middle of alert \t
it's not perfect, it's close 1 can move text center in alertbox.
\t
works perfect firefox not chrome. love chrome, web developer pain in neck.
my alert box looks messy without \t
s. google need fix issue...
suggestion
so it's better to create own. example,
have here : demo
the best thing used display message using toast messages. pops up, show message in beautiful box , pops out in sleek manner.
have @ materialize css toasts
Comments
Post a Comment