So I have an unordered list, heading and a list item, in that order. I assigned different classes to the heading and I just want to show the first child of each type of class. Basically this is to add sub categories to a page with all products
Here is the code:
.product-list-list {
.cat-1 {
display: hidden;
}
.cat-1:first-child {
display: block;
}
.cat-2 {
display: hidden;
}
.cat-2:first-child {
display: block;
}
}
<ul class="product-list-list>
<h5 class="cat-1">sub category 1</h5>
<li>product details</li>
<h5 class="cat-1">sub category 1</h5>
<li>product details</li>
<h5 class="cat-1">sub category 1</h5>
<li>product details</li>
<h5 class="cat-2">sub category 2</h5>
<li>product details</li>
<h5 class="cat-2">sub category 2</h5>
<li>product details</li>
<h5 class="cat-2">sub category 2</h5>
<li>product details</li>
</ul>
Results I got: sub category 1
sub category 2 is not showing