vendredi 3 avril 2020

Why should I embed navigation bar links into a list and then into a navigation bar?

From w3schools.com:

A navigation bar is basically a list of links, so using the <ul> and <li> elements makes perfect sense:

And every over tutorial about html says almost the same. It doesn't makes sense to me. Why it must look like this

 <nav>
   <ul>
    <li><a href="default.asp">Home</a></li>
    <li><a href="news.asp">News</a></li>
    <li><a href="contact.asp">Contact</a></li>
    <li><a href="about.asp">About</a></li>
  </ul>
</nav>

but not like this

<nav>
  <a href="default.asp">Home</a>
  <a href="news.asp">News</a>
  <a href="contact.asp">Contact</a>
  <a href="about.asp">About</a>
</nav>

Embedding links into a list requires writing additional styling for said list, and just seems like unnecessary steps.




Aucun commentaire:

Enregistrer un commentaire