本文介绍了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)
发布评论