D
D
Dubrovin2018-03-11 10:38:16
css
Dubrovin, 2018-03-11 10:38:16

Is there an objective reason to use ul li inside a menu?

Is there an objective reason to use ul li inside a menu?
Option number 1:

<nav class="menu">
    <div class="menu__item"><a class="menu__link" href="#">Menu Item</a></div>
    <div class="menu__item"><a class="menu__link" href="#">Menu Item</a></div>
    <div class="menu__item"><a class="menu__link" href="#">Menu Item</a></div>
</nav>

Option #2:
<nav class="menu">
    <ul class="menu__list">
        <li class="menu__item"><a class="menu__link" href="#">Menu Item</a></li>
        <li class="menu__item"><a class="menu__link" href="#">Menu Item</a></li>
        <li class="menu__item"><a class="menu__link" href="#">Menu Item</a></li>
    </ul>
</nav>

How is option #2 better than option #1?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Polos, 2018-03-11
@dimovich85

Availability. Here is an interesting video about it: https://youtu.be/KAK-WAb9vow

P
Pavel Gogolinsky, 2018-03-11
@gogolinsky

Of course I have. Menu is a list of links, ul is a tag for the list.
If you forget about this, then in the first version you can <nav>replace it with <div>. Then <a>replace with <div>, and write the click handling in js.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question