I have an element that can contain multiple unordered lists.
I want to selectivly style the separators - that is the separators that divide LI elements and separators that divide UL elements. Here's some HTML:
What I'm effectively trying to achieve is:
- Everything is separated either by UL separator or LI separator
- If it's the last UL, no UL separator but last LI has a separator
- If it's not the last UL - the last LI has no separator
<div>
<ul>
<li></li><!-- has blue bottom border -->
<li></li><!-- has blue bottom border -->
<li></li><!-- HAS NO BOTTOM BORDER -->
</ul><!-- has green bottom border -->
<ul>
<li></li><!-- has blue bottom border -->
<li></li><!-- has blue bottom border -->
<li></li><!-- has blue bottom border -->
</ul><!-- HAS NO BOTTOM BORDER -->
</div>
I've come up with this code - which works but the last LI of the last UL dows not have a separator.
.nav-blue ul
{
border-bottom:solid 0.5rem Green;
}
.nav-blue ul:last-child
{
border-bottom:0;
}
.nav-blue li
{
border-bottom:solid 0.1rem Blue;
}
.nav-blue li:last-child
{
border-bottom:0;
}
/* This does not work */
.nav-blue not(ul:last-child) li:last-child
{
border-bottom:solid 0.1rem Blue;
}
There may be also be prettier ways of achieving this and I'm keen for help and further advice.
Thanks in advance.
ulorlielements?