0
HTML Menu
Okay so I'm currently coding foundations and I have gotten creating menus on the web with html, where "nav" and "href" was mentioned in creating a menu on the webpage but I'm finding it difficult to understand the difference and how to even use them in my coding. Please any assistance?
2 ответов
+ 1
href is an attribute which points to another page/asset. You use it for navigation/linking. It is used inside <a>, <link> and more tags. Example: <a href="https://anotherpage.com">Go</a>
<nav> is a semantic container tag used for grouping navigation links together. Visually it does NOT make a difference, it helps browser and search engines better understand your webpage structure. A common example of using nav tag is when grouping some navigation links in a menu like this:
<nav>
<a href="/home">Home</a>
<a href="/about">About</a>
<a href="contact">Contact Me</a>
</nav>
It's basically like telling search engines and crawlers "These aren't just a bunch of random links, they are the main navigation and important for the webpage."
0
Afnan Irtesum Chowdhury thank you