如何让 HTML5 标记元素在 IE 中良好显示
让
、
和
通常,当我将 CSS 应用于 HTML5 元素时,样式不会发生。但我在其他网站上看到过它,例如 colourfreak.com,并且需要一些帮助。
我认为这与选择器不接受新标签名称有关。所以这样的事情是行不通的:
nav a {
text-decoration: none;
}
详细的解释或一篇不错的文章会很有帮助。谢谢!
What is the best way to get HTML5 markup elements like <header>
, <section>
, and <footer>
to display well in IE?
Usually, when I apply CSS to the HTML5 elements, the styling doesn't take place. But I have seen it done on other sites, like colourfreak.com, and would like some help.
I think it has something to do with the selectors not accepting new tag names. So something like this wouldn't work:
nav a {
text-decoration: none;
}
A detailed explanation or nice article would be helpful. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 IE,我们必须使用 JS 创建新的 HTML5 元素。创建新文件,将其命名为 html5.js 并将此脚本包含在您的
区域中。一切都会好起来的。
这仅对于 IE 是必需的,因此您可以使用条件注释:
由于这些元素显示为内联元素,您可能需要在 CSS 文件中添加此规则:
For IE we have to create new HTML5 elements with JS. Create new file, name it for example html5.js and include this script in your
<head>
area. All will be fine.This is required only for IE, so you can use conditional comments:
Because of these elements are displayed as inline elements, you'll probably want to add this rule In your CSS file:
您可以使用 HTML5 Shiv...
您也可以使用 HTML5 样板...(包括 HTML 5 shiv)
http:// html5boilerplate.com/
You can use the HTML5 Shiv...
Also you could use the HTML5 boilerplate... (Includes the HTML 5 shiv)
http://html5boilerplate.com/
我非常确定 Modernizer 会解决您的问题以及 CSS3 的许多其他跨浏览器问题。
I'm pretty sure Modernizer will solve your problem and alot of other cross-browser issues with CSS3 as well.