如何在 javascript alert() 中增加字体大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6507823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to increase font size in javascript alert()
提问by ptamzz
Can I control the font size of the string in a javascript alert()
call??!
我可以在 javascriptalert()
调用中控制字符串的字体大小吗??!
I've the image below and I want to increase the font size so that it is legible.
我有下面的图片,我想增加字体大小以使其清晰易读。
回答by Pekka
Can I control the font size of the string in a javascript alert() call??!
我可以在 javascript alert() 调用中控制字符串的字体大小吗??!
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.
您将不得不使用基于 JavaScript 的对话框窗口替代方案,例如jQuery UI 对话框。
回答by Raoul
No, this is controlled by the browser. I don't use alerts anymore I use jQuery UI dialog, it's fully customizable
不,这是由浏览器控制的。我不再使用警报我使用jQuery UI 对话框,它是完全可定制的
回答by benqus
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. :)
如果你想自己创建一个完全自定义的东西,在你的 DOM 中创建一个新的 div 元素(作为 body 的最后一个子元素,并给它你可以或你使用的最大 z-index),定位绝对(顶部:0,left:0),然后在那里写任何你想要的 HTML。使用一些 JS,您可以将其定位到屏幕/布局的中心。:)
Or use jQuery UI Dialog... :)
或者使用jQuery UI 对话框... :)