gpt4 book ai didi

HTML5 导航标签的正确用法

转载 作者:技术小花猫 更新时间:2023-10-29 11:42:58 24 4
gpt4 key购买 nike

<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.

所以请随意将两者包装在一个导航标签中。不要包装页脚,而是在此处使用页脚标签 :)

在此处阅读规范:http://dev.w3.org/html5/spec/Overview.html#the-nav-element

关于HTML5 导航标签的正确用法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5178761/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com