DEV Community

Angie Walls
Angie Walls

Posted on

My existential problem as a beginner "nav" = "a"?

When I heard that the "nav" element was used to navigate and previously I have learned that the "a" element was used to navigate between pages I was confused, I thought that they both served the same purpose or had the same function, then I investigated in FreeCampCode and MND and I could see that they are definitely not the same.
Nav is used to allocate a space or section on your web page to navigate and nested within nav is an "a" which is the link that makes the jump. You can find more information nav

e.g.

<nav>       
   <ul>
       <li><a href="Https://mytoping">menu toping </a></li>           
       <li><a href="Https://mycupon">menu coupon </a></li>              
   </ul>
</nav>
Enter fullscreen mode Exit fullscreen mode

The structure of the "a" element should at least have the "href" attribute, they always go in the opening tag followed by the "=" sign and the assigned value.
The value can be a URL for external links or an id of another html element to create internal links

e.g.

<a href="http://AnyLink">any page</a>
Enter fullscreen mode Exit fullscreen mode

Basically "nav" is the box that nests the element "a" which are the internal or external links that make the jump to somewhere

Top comments (0)