IE不是样式HTML5标签(用shiv)

编程入门 行业动态 更新时间:2024-10-25 22:36:28
本文介绍了IE不是样式HTML5标签(用shiv)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图风格一个< header> ,它不工作在IE。我使用Modernizr,但我自己尝试了shiv。

I'm trying to style a <header> and it's not working in IE. I'm using Modernizr, but i've tried the shiv by itself.

示例代码

<section> <header> <h1>Title</h1> </header> <p>Body</p> </section>

样式:

section { border: 2px dotted black; padding: 0.25em; } header h1 { background-color: #ccc; text-align: center; margin: 0; }

我希望在标题和节内容周围有一个边框,

I expect a border around the header and section content, but instead there is just an '[' looking border and the header is beneath it.

出现了什么问题?

推荐答案

对于IE,即使使用shiv,也需要将HTML 5元素声明为块元素。我使用这一行的Internet Explorer,但你可以修改它所需的元素。

With IE, even with the shiv, you need to declare the HTML 5 elements as block elements. I use this line for Internet Explorer, but you can modify it for the elements you need.

header,nav,article,footer,section,aside,figure,figcaption{display:block}

从 Modernizr文档:

您也可能想将这些元素中的许多元素设置为 display:block;

更多推荐

IE不是样式HTML5标签(用shiv)

本文发布于:2023-07-13 03:15:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1099771.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:样式   标签   shiv

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!