微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

原文地址:https://www.jb51.cc/html5/169637.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。