I've begun to use html tags on my pages, and I'm trying to determine what is the proper usage of the NAV tag. I've read the documentation, and it seems like I should be okay with what I have, but I noticed that most other developers have their navigation 'blocks' within "ul" "li" tags. I've using divs.
My question is, what are the pros / cons to using "ul" "li" tags rather than divs?
And would the following work with nav?
<nav>
<div id="navBar">
<div id="navItem1"><a></a></div>
<div id="navItem2"><a></a></div>
<div id="navItem3"><a></a></div>
<div id="navItem4"><a></a></div>
</div>
</nav>
The code you posted isn't a best practice. It should be:
<nav>
<ul>
<li><a></a></li>
<li><a></a></li>
<li><a></a></li>
<li><a></a></li>
</ul>
</nav>
<ul>
and <li>
tags are better than using div
tags, and are almost always used for menus. By using ul
s and li
s, you don't clog up your code with WAY too many IDs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With