css - css 选择器链中的 html 5 元素

标签 css html requirejs modernizr

有一个工作示例 here

我已经运行了 Modernizr;我有

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
  display: block;
}

...在 css 中,但在 IE8 及以下版本中,即使元素正确包装了子元素,样式也没有携带?

谁能告诉我我做错了什么?

谢谢

詹姆斯

最佳答案

据我所知,您没有在源代码中的任何地方包含 modernizr。

我确实注意到您在页面底部有一个缩小的 require.min.js 脚本。如果该脚本正在动态加载 modernizr,它将破坏 HTML5 shiv,因为 document.createElement 需要在旧版本的 IE 中调用 before 使用任何元素在 DOM 中。

来自Modernizr Documentation :

Drop the script tags in the of your HTML. For best performance, you should have them follow after your stylesheet references. The reason we recommend placing Modernizr in the head is two-fold: the HTML5 Shiv (that enables HTML5 elements in IE) must execute before the , and if you’re using any of the CSS classes that Modernizr adds, you’ll want to prevent a FOUC.

关于css - css 选择器链中的 html 5 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13372470/

相关文章:

c++ - 想要在 Web 应用程序中使用 native C 库,我有哪些选择?

javascript - 当不存在周围元素时跟踪 Canvas 中的鼠标位置

jquery - 加载多个版本的 jQuery 时的 RequireJs 问题

javascript - Backbone targetModel = undefined

html - 选择特定父元素的子元素

html - 如何使 div 的背景响应?

html - 具有操作 =""的表单

javascript - Requirejs "text!"替代 webpack 的插件

css - 制作一个至少与页面一样高的div

javascript - 过渡固定导航栏 - CSS