HTML/Elements/nav

From Web Education Community Group
< HTML‎ | Elements
Jump to: navigation, search

<nav>

The <nav> element represents a section with navigation links.

Point

  • Navigation links:
    • links to other pages [Example A]
    • links to within tha page
  • Not all groups of links on a page need to be in a nav element.
    The nav element is appropriate for only section only sections that consist of major navigation blocks.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.


HTML Attributes

See global attributes.


Examples

Example A

[try it]:

<header>
  <h1>Wake up sheeple!</h1>
  <p><a href="news.html">News</a> -
     <a href="blog.html">Blog</a> -
     <a href="forums.html">Forums</a></p>
  <p>Last Modified: <time>2009-04-01</time></p>
  <nav>
   <h1>Navigation</h1>
   <ul>
    <li><a href="articles.html">Index of all articles</a></li>
    <li><a href="today.html">Things sheeple need to wake up for today</a></li>
    <li><a href="successes.html">Sheeple we have managed to wake</a></li>
   </ul>
  </nav>
</header>

Nav01.png

HTML Reference

The HTML5 specification defines the <nav> element in 4.4.3 The nav element.