directory search
Attributes accesskey (attribute) class (attribute) contenteditable (attribute) contextmenu (attribute) data-* (attribute) dir (attribute) draggable (attribute) dropzone (attribute) Global attributes hidden (attribute) id (attribute) itemid (attribute) itemprop (attribute) itemref (attribute) itemscope (attribute) itemtype (attribute) lang (attribute) slot (attribute) spellcheck (attribute) style (attribute) tabindex (attribute) title (attribute) translate (attribute) Elements a abbr address area article aside audio b base bdi bdo blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 head header hr html i iframe img input input type="button" input type="checkbox" input type="color" input type="date" input type="datetime"-local input type="email" input type="file" input type="hidden" input type="image" input type="month" input type="number" input type="password" input type="radio" input type="range" input type="reset" input type="search" input type="submit" input type="tel" input type="text" input type="time" input type="url" input type="week" ins kbd label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param picture pre progress q rp rt rtc ruby s samp script section select slot small source span strong style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var video wbr Miscellaneous Attributes Block-level elements CORS enabled image CORS settings attributes Element Inline elements Kinds of HTML content Link types Microdata Optimizing your pages for speculative parsing Preloading content Reference Supported media formats Using the application cache Obsolete acronym applet basefont big blink center command content dir element font frame frameset hgroup image input type="datetime" isindex keygen listing marquee nextid noframes plaintext strike tt xmp
characters

HTML导航栏(<nav>) 描绘一个含有多个超链接的区域,这个区域包含转到其他页面,或者页面内部其他部分的链接列表.

内容类别


Flow content, sectioning content, palpable content.

允许的内容


Flow content.

标记遗漏

没有,起始和结束标签都是强制性的。

允许父级

任何接受 flow content 的元素。

允许ARIA角色

没有

DOM界面

HTMLElement

属性

这个元素只包含全局属性。

使用说明

  • 并非文件的所有链接都必须位于<nav>仅用于主要导航链接块的元素中,通常<footer>元素通常有一个不需要在<nav>元素中的链接列表。

  • 一个网页也可能含有多个<nav>元素,例如一个是网站内的导航列表,另一个是本页面内的导航列表.

  • 对于屏幕阅读障碍的人,可以使用这个元素来确定是否忽略初始内容.

例子

在这个例子中,一个<nav>块被用来包含<ul>链接的无序列表()。使用合适的CSS,可以将其显示为侧栏,导航栏或下拉菜单。

<nav class="menu">  
    <ul>    
        <li><a href="#">Home</a></li>    
        <li><a href="#">About</a></li>    
        <li><a href="#">Contact</a></li>  
    </ul>
</nav>

规范

Specification

Status

Comment

HTML Living StandardThe definition of '<nav>' in that specification.

Living Standard

No change since latest W3C snapshot.

HTML5The definition of '<nav>' in that specification.

Recommendation

Initial definition

浏览器兼容性

Feature

Chrome

Edge

Firefox

Internet Explorer

Opera

Safari

Basic Support

5

(Yes)

4

9

11.1

4.1

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

4

9

11

4.2

Previous article: Next article: