HTML Tutorial

HTML Tag: <nav>

Usage of <nav>:

  • Defines a section of a document that provides links to other pages within the same site.

Attributes of <nav>:

  • id: Unique identifier for the <nav> element.
  • class: Used to specify additional styling classes.

Examples with <nav>:

<nav><a href="home.html">Home</a><a href="about.html">About Us</a></nav>

Simple HTML Example:

<!DOCTYPE html>
<html>
<head>
  <title>Exploring the `<nav>` Tag</title>
</head>
<body>

  <nav>
    <a href="index.html">Home</a>
    <a href="contact.html">Contact</a>
  </nav>

</body>
</html>

Enhancements for Accessibility and Ease of Use:

  • Use meaningful link text to describe destination pages.
  • Provide alternative text (alt text) for images within navigation links.
  • Ensure sufficient color contrast and font size for easy visibility.
  • Use keyboard-accessible navigation options for users who cannot use a mouse.