HTML5 nav标记使用正确

前端之家收集整理的这篇文章主要介绍了HTML5 nav标记使用正确前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<ul class="mainMenu">
    <li><a href="#">Home</a></li>
    <li><a href="#">Forum</a></li>
    <li><a href="#" class="mainSelected">Construct</a></li>
    <li><a href="#">Arcade</a></li>
    <li><a href="#">Manual</a></li>
</ul>
<ul class="subMenu">
    <li><a href="#">Homepage</a></li>   
    <li><a href="#">Construct</a></li>
    <li><a href="#" class="underSelected">Products</a></li>
    <li><a href="#">Community Forum</a></li>
    <li><a href="#">Contact Us</a></li>
</ul>

在语义上更正确的是< nav>围绕这两个< ul>单独,还是应该一个导航包?

还是使用nav标签来包裹我的页脚菜单项是合适的吗?

解决方法

引用规格:

The nav element represents a section
of a page that links to other pages or
to parts within the page: a section
with navigation links.

Not all groups of links on a page need
to be in a nav element — only sections
that consist of major navigation
blocks are appropriate for the nav
element. In particular,it is common
for footers to have a short list of
links to varIoUs pages of a site,such
as the terms of service,the home
page,and a copyright page. The footer
element alone is sufficient for such
cases,without a nav element.

所以,请随意包装在一个单一的nav标签。不要包装页脚,但在这里使用页脚标签:)

阅读规格在这里:http://dev.w3.org/html5/spec/Overview.html#the-nav-element

猜你在找的HTML5相关文章