A
A
Anastasia2020-05-30 21:05:28
HTML
Anastasia, 2020-05-30 21:05:28

Why is a list better than a div block?

Hello. Often in the layout I see how they use such a construction in the menu. It doesn't matter if it's a horizontal menu or a vertical one.

<ul class="menu">
  <li>Главная</li>
  <li>Новости</li>
  <li>Блог</li>
</ul>


Why is it better than this design
<div class="menu">
  <div>Главная</div>
  <div>Новости</div>
  <div>Блог</div>
</div>

or this, if you still have links, not buttons:
<div class="menu">
  <a>Главная</a>
  <a>Новости</a>
  <a>Блок</a>
</div>


What's the point of having lists on the menu when you can like this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WapSter, 2020-05-30
@nastya97core

For accessibility. In order for the blind to understand that there is a list of such and such a number of links in front of him, it is even better to shove the list with navigation links into the nav tag.

S
survivor2005, 2020-05-31
@survivor2005

This is done for the readability of the code and for search engines this is a plus. Lists are more meaningful to the search engine than divs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question