12

Can I control the font size of the string in a javascript alert() call??!

I've the image below and I want to increase the font size so that it is legible.

Javascript Alert Pop Up

ptamzz
  • 8,835
  • 31
  • 88
  • 144
  • 1
    possible duplicate of [Custom alert using Javascript](http://stackoverflow.com/questions/3391864/custom-alert-using-javascript) – Pekka Jun 28 '11 at 14:13

3 Answers3

18

Can I control the font size of the string in a javascript alert() call??!

Nope. How the alert window is rendered is entirely up to the browser.

You would have to use a JavaScript based dialog windows alternative like jQuery UI Dialog.

Pekka
  • 431,103
  • 135
  • 960
  • 1,075
2

No, this is controlled by the browser. I don't use alerts anymore I use jQuery UI dialog, it's fully customizable

Raoul
  • 3,781
  • 3
  • 22
  • 30
2

As far as I know, it is not possible.

However, you have a several choices:

If you want to create it yourself as a totally custom thing, create a new div element in your DOM (as the last child of the body, and give it the maximum z-index you can or you use), position that absolute (top:0,left:0), and write there HTML whatever you want. With some JS you can positon it to center of the screen/layout. :)

Or use jQuery UI Dialog... :)

benqus
  • 1,109
  • 2
  • 10
  • 24