简体   繁体   English

如果CSS规则发生变化,是否需要刷新浏览器

[英]If a CSS rule changes, does the browser need to be refreshed

如果我通过javascript更改了CSS规则,是否需要做任何事情来“刷新”浏览器以使用更新后的规则重新显示当前页面?

No--a refresh isn't necessary--and if it did occur it would restore the document to its original state. 否-不需要刷新-如果确实发生了刷新,则会将文档恢复到原始状态。

The change should take place immediately (setting display: none, for example). 更改应立即进行(例如,设置显示:无)。 Use FireFox plugin FireBug ( http://getfirebug.com/ ) or the IE Developer Toolbar (built into IE8 and available as a free plugin for previous versions) to dynamically view the HTML to ensure the change you think is taking place is actually occurring. 使用FireFox插件FireBug( http://getfirebug.com/ )或IE开发者工具栏(内置于IE8中,并且可以作为以前版本的免费插件使用)动态查看HTML,以确保您认为实际发生的更改。

通过JavaScript快速更改CSS属性应该会自动在用户的Web浏览器中进行更改,除非您的脚本出现错误(例如用户是否关闭了JavaScript)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM