<nav>标签,所有浏览器都支持吗?</nav>

时间:2014-02-24 16:22:27

标签: html css html5 nav navigationbar

我找到了this tutorial, that uses a <nav> tag。该演示甚至在IE7上运行良好。 然而,w3cshools mention that this tag is NOT supported on IE8 and below

那么,真相是什么,我应该保留这个导航标签,还是将其更改为div? (它会毁了什么吗?)

2 个答案:

答案 0 :(得分:1)

您需要包含HTML5 shiv script才能在旧的IE浏览器中设置HTML5元素的样式:http://code.google.com/p/html5shiv/

要使用,请在CSS上方的元素中包含以下脚本:

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

参见 - &gt; html5 new elements (header, nav, footer, ..) not working in IE

另一种选择是使用Modernizr,其中包括HTML5 Shiv,还提供HTML5功能检测。

答案 1 :(得分:0)

当然你可以使用div代替,但使用nav的目的是摆脱div。

不要浪费时间尝试让HTML5在旧浏览器中运行。