Is there a way to style an element differently based on the number of subelements it contains?
<div class="wrapper">
<div class="element" />
</div>
or...
<div class="wrapper">
<div class="element" />
<div class="element" />
</div>
or...
<div class="wrapper">
<div class="element" />
<div class="element" />
<div class="element" />
</div>
I am looking for a solution using only CSS, similar to the following:
.wrapper .element {
width: 50%;
}
.wrapper .element:only-child {
width: 75%;
}
However, I am struggling to differentiate between having 2 elements or 3 elements. Is this achievable using pure CSS?
Any help would be greatly appreciated.