开发者

Html5 <nav> tag use

Can we use <nav> tag with the rest of <h开发者_如何转开发eader> tag in HTML 5?


The HTML5 spec has an example where a nav element is a child of a header element, so yes.


The <nav> tag can be used to wrap any navigational links. Whether those links are in the header or the footer or otherwise in the page, if they are a distinct section for navigation, those links can be grouped within a <nav> tag.

See http://www.w3schools.com/html5/tag_nav.asp


if it is a main menu in the top part of the web page use it inside the header

 <header>
    <nav>
      <ul>
        <li><a href="#">1</a></li>
        <li><a href="#">2</a></li>
      </ul>
    </nav>
 </header>

also you can use the nav in the footer .. if this navigation is of "Primary Importance" like the top menu


The HTML5 specification states the following:

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 list of links to various key parts of a site, but the footer element is more appropriate in such cases, and no nav element is necessary for those links.

The nav tag should not be used to wrap all forms of navigation and is reserved for 'Major Navigation'


I use

<header>
    <a href="#" id="logo" ></a>
    <nav>
        <a href="#">ling1</a>
        <a href="#">link2</a>
        <a href="#">link3</a>
        <a href="#">link4</a>
    </nav>
</header>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜