I have the following markup:
ul {
list-style-type: none;
}
ul:not(.sub-menu) {
padding: 0px;
}
ul li {
padding-top: 10px;
}
ul li:first-child:not(.sub-menu) {
margin-bottom: 30px;
}
.submenu {
margin-left: 20px;
}
<ul>
<li>test</li>
<li>test</li>
<li>test</li>
<li>has submenu
<ul class="submenu">
<li>child</li>
<li>child</li>
</ul>
</li>
</ul>
I want the li
's which doesn't have a nested ul
to have a margin-bottom
of 30px
. But with my current approach, it adds a margin to the nested ul li
elements too.
I almost need to do ul li:first-child:not(.sub-menu li)
but that's not possible. What's the workaround?