Publish in HTML Tutorial el 25/05/2025 13:51
The HTML <nav>
element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. This is the semantic container for major navigation blocks like menus, tables of contents, or indexes.
Key characteristics of <nav>
:
Here's the basic structure of a <nav>
element:
A simple horizontal navigation menu with inline styling:
A vertical navigation menu with list items:
A navigation menu with JavaScript-powered dropdown functionality:
A responsive navigation that collapses on small screens with a toggle button:
A semantic breadcrumb navigation to show the user's location in the site hierarchy:
<nav>
for major navigation blocks, not for all groups of links.aria-label="Main navigation"
).<nav>
for every group of links (footer links, social media icons, etc.)<nav>
elements unnecessarily<div>
when <nav>
would be more appropriateThe <style> HTML element contains style information for a document, or part of a document. ...
The <strong> element is used to indicate that its content has strong importance, seriousnes...
The <span> element is an inline container used to mark up a part of a text or document. Unl...
The <source> element is used to specify multiple media resources for media elements like &l...
The <small> element is used to represent side-comments and small print, typically for discl...
HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...