清洁渐进增强
我正在使用渐进增强来构建网站。这包括菜单、幻灯片等。这些项目作为无序列表包含在页面中,然后 JavaScript 应用格式。
我关心的是:如何避免出现未格式化内容(在应用格式之前无序列表可见)?有这方面的最佳实践吗?
重要提示:网站必须保持 SEO 友好且可访问(这就是我首先使用渐进增强的原因)。例如,将无序列表的初始样式设置为 display:none 是毫无疑问的。
I am using progressive enhancement to build a website. This includes menu, slideshow, etc. The items are included in the page as unordered lists, then JavaScript applies the formatting.
My concern: how can I avoid the flash of unformatted content, where the unordered lists are visible before the formatting is applied? Are there best practices for this?
Important: the site must remain SEO friendly and accessible (this is why I am using progressive enhancement in the first place). So for example it is out of question to set the initial style of the unordered lists to display:none.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 CSS 代替 JavaScript 进行格式化。
Use CSS for formatting instead of JavaScript.
当您使用 CSS 检测到 JavaScript 可用并且在包含任何内容之前运行某些脚本时,您可以间接将样式设置为
display: none
:You can indirectly cause the style to get set to
display: none
when you detect JavaScript is available by using CSS and some script run before any of the content is included: