The <nav> element

As per the MDN definition:

The HTML Navigation Element (<nav>) represents a section of a page that links to other pages or to parts within the page: a section with navigation links.

Here are a few important points to remember about the <nav> element:

  • It is used to group a list or collection of links. The links can either point to external resources or to other pages within the site/app.
  • It's common practice to use an unordered list <ul> inside the <nav> element to structure the links, because it's easier to style.
  • Including a <nav> in the <header> element is also a common practice but not required.
  • Not all groups of links have to be inside a <nav> element. If we have a list of links inside a <footer> tag, then its isn't really necessary ...

Get Mastering Responsive Web Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.