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

发布于 2024-07-11 07:19:44 字数 71 浏览 3 评论 0原文

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

If I have changed a CSS rule via javascript, do I need to do anything to "refresh" the browser to redisplay the current page using the updated rules?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

能怎样 2024-07-18 07:19:44

不——刷新不是必需的——如果确实发生了,它会将文档恢复到其原始状态。

更改应立即发生(例如,设置显示:无)。 使用 FireFox 插件 FireBug (http://getfirebug.com/) 或 IE 开发工具栏(内置于 IE8 中并可用)作为以前版本的免费插件)来动态查看 HTML,以确保您认为正在发生的更改确实发生。

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.

软的没边 2024-07-18 07:19:44

通过 JavaScript 动态更改 CSS 属性应该自动在用户的 Web 浏览器中进行更改,除非您的脚本出现问题或者用户关闭了 JavaScript。

Changing CSS properties on the fly via JavaScript should automatically make the change in the user's web browser unless there is something wrong with your script of if the user has JavaScript turned off.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文