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 to include those links in a<nav>
as well.There can be more than one
<nav>
element in a single page, for example, a main navigation, a utility navigation, and a<footer>
navigation...