How do you alter the font size in the js alert box's please?

Has anyone found a way to alter the size of the text in a javascript alert box please ?

Any help appreciated.


This isn’t something you can do with HTML, which is a markup language for web pages.

You need to go into the operating system/window manager settings to change this, or, possibly, the browser preferences.

Thanks. I guess there’s no other way of showing it in a larger font ? ? Other than js ?

Please read what I posted! You can’t do it with JavaScript, either. It’s a system setting or a browser setting.

The only alternative is a pseudo-modal box you overlay on the screen, which lays a transparent or semi-opaque “curtain” over everything else. Commonly called a lightbox.

Please look carefully at what I posted! Especially the bit where it says “Other than js ?”

Thanks Raffles, the helps appreciated. I’ll look at that as well.

You can NOT do it with Javascript. That is what Tommy is saying. :slight_smile:

Yep, got that the FIRST time Ben, that’s why I then said “Other than js ?”

Anyway, no worries :slight_smile:

It’s just the way you said it that got people confused :). Other then JS implies that “other then using javascript is there a way to do this”.

I know that I interpreted it that way, and so did Bpartch and Tommy :slight_smile:

Yep, but I did say it clearly enough. There would be others that understood me as well, but let’s move on a little now :slight_smile:

Apparently you didn’t as 3 people have now misunderstood it. :rofl:

Apparently, according to pm’s, I did. After all, it was “Other than js ?” :lol: :lol:

Just about everyone would interpret “other than JS” as implying that there is a way to do it with JavaScript but you are looking for a different solution.

Raffles provided you with a way to do it using JavaScript but not using an alert().

Since the alert() is JavaScript there isn’t any way to do an alert without JavaScript. There also isn’t any way to change the text size in the alert unless you change the font size in the operating system (which only the individual computer owner can do).

Using JavaScript but not using alert() is therefore the only way of doing this.

Therefore the answer to “other than JS” is “no there isn’t”.

Raffles (and others who’ve pm’d) seemed to understand, that “Thanks. I guess there’s no other way of showing it in a larger font ? ? Other than js ?” would mean any other way, apart from js, but anyway, no worries, have moved on from that now. Suggest others here do as well.

This question doesn’t belong in the HTML/XHTML forum at all. Unfortunately the SitePoint moderators don’t care any more, but you should still try to post in the appropriate forum.

In this case you’d need JavaScript to display the faux-alert, but the main issue would be the CSS needed to render it like a message box. So you should ask a moderator to have this thread moved to the CSS forum.

Many thanks for the helpful response Tommy. Now we’re in the css forum, hopefully, someone will come in with some ideas on how to do this :slight_smile:


Can you explain what you require now that it has been clarified that you can’t change the text in an alert box and we’ll try to help. Are you just looking for some sort of styled pop up message box?

Something like the examples on this page perhaps.

I had a stab at doing this once, trying to do it as CSS-only as possible. It’s possible to do it only with CSS (by using the CSS3 pseudo-class) but that’s not a cross-browser method.

For a demonstration go here. The CSS takes advantage of position:fixed and javascript is used only for the event handling and positioning at the right height up the page (and loads of other stuff, but that script was a general use-one, you could just extract the event-handling and positioning bits). It’s a bit old and untested with the newer browsers, but it still seems to work and should at least give you a general idea.

Thanks Paul, I love the page on that link, excellent work with the rollovers, but what I’m looking for, is a message to tell people in FF to press Ctrl + D if trying to save to favs.