I have an unordered list with a fixed width of 100px with nested li. Each li is filled with a background color.
The number of nested li could range from 1 to 5. I want to display a color pallette where each li would represent a color. However, the width of the li should be equal depending on how many nested li are in the ul. For instance if there is only one li with id = "1", then
#1{
width: 100%;
height:20px;
color: #222222;
}
if there are two the its width should be 50% of the ul and so on.
I'm able to do this using using php and inline css but I'm curious if there is a way to do this with pure css in a stylesheet. Any help is deeply appreciated.
Sample markup with 1 <li>
<ul>
<li id="1"></li>
</ul>