I have a menu with up to 3 levels of nested lists. I need to select only the first level text and ignore the nested content. I tried to use .menu > ul> li {}
(and some variations of it) and it did not work out what I needed.
I tried to use .menu li:first-child > ul
and it resulted in the opposite of what I need, that is, I brought everything but the first level. I tried to use pseudo-seletor :not
in the above condition, but I could not.
So I need help with this selector. How to do?
<div class="menu">
<ul>
<li>Item nível 1
<ul>
<li>Item nível 2
<ul>
<li>Item nível 3</li>
<li>Item nível 3</li>
<li>Item nível 3</li>
</ul>
</li>
<li>Item nível 2</li>
<li>Item nível 2</li>
</ul>
</li>
<li>Item nível 1
<ul>
<li>Item nível 2</li>
<li>Item nível 2</li>
<li>Item nível 2</li>
</ul>
</li>
</ul>
</div>