Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference is usage between <nav> and <menu> in html5?

Tags:

html

markup

What is the difference is usage between nav and menu in html5?

nav or menu, which one?

like image 965
George Mann Avatar asked Apr 05 '11 01:04

George Mann


People also ask

What is the difference between menu and navigation bar?

Menu bars allow nested menus (aka sub-menus) meaning you can put more menu items if it doesn't fit in your menu bar. However, navigation bars can't do those, and they're used for things that aren't related to one another. There are also clear differences in placements as well.

What is the difference between NAV and header in HTML?

The <header> tag is generally used for heading purposes, you may see the use of these header tags <h1> to <h6>. The <nav> tag is used inside the <header> tag . This may happen if <nav> is very small and if the content of <nav> tag is used to identify the different web content.

What is the difference between NAV and DIV in HTML?

There is no difference between and . DIV is original HTML tag while NAV was introduced as part of new HTML5 semantic tags. They behave exactly the same.

What is the purpose of NAV tag in HTML5?

The <nav> HTML element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. Common examples of navigation sections are menus, tables of contents, and indexes.


2 Answers

Straight from the horse's mouth:

http://dev.w3.org/html5/spec-author-view/interactive-elements.html#menus

The menu element represents a list of commands.

E.g.:

<menu label="File">
   <button type="button" onclick="fnew()">New...</button>
   <button type="button" onclick="fopen()">Open...</button>
   <button type="button" onclick="fsave()">Save</button>
   <button type="button" onclick="fsaveas()">Save as...</button>
</menu>

http://dev.w3.org/html5/spec-author-view/sections.html#the-nav-element

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.

like image 65
deceze Avatar answered Oct 27 '22 03:10

deceze


<nav> is a general section of the site layout that holds navigation content

<menu> is a list of commands within the navigation or any other layout section

like image 36
MikeM Avatar answered Oct 27 '22 02:10

MikeM