如何创建和应用CSS到javascript警报 [英] How to create and apply CSS to javascript Alert

查看:125
本文介绍了如何创建和应用CSS到javascript警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我,如何在javascript警报上应用CSS。
感谢

Please tell me, how to apply CSS on javascript Alert. Thanks

推荐答案

你不能。 alert()只是显示一个原生消息框,所以它会看起来不过操作系统看起来。

You cannot. alert() simply shows a native message box, so it'll look however the OS makes it look.

一般来说,你不应该使用警报框,因为它们是讨厌的,他们阻止整个浏览器。*你可以总是创建一个假警报框用JavaScript实现相同的效果。然后你可以为你想要的样式,使用普通的CSS。如果您使用jQuery,则可以 SimpleModal 演示)。

In general, you shouldn't be using alert boxes because they are annoying and they block the entire browser.* You could always create a fake alert box with JavaScript that achieves the same effect. You could then style it however you want with normal CSS. If you use jQuery, there's SimpleModal (demos).

*现代浏览器通常只会阻止生成警报的窗口,但它们仍然恼人,你仍然不应该使用它们。 :)

这篇关于如何创建和应用CSS到javascript警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆