Trying to get next element after li.active class
I am trying to get the next element after the .active element with css, the element that gets the .active class, is the first list-item of the 'Lightslider'.
I've tried the code below:
.lslide.active + li:nth-child(1) {
-ms-transform: scale(1.3);
-webkit-transform: scale(1.3);
transform: scale(1.3);
}
Is this possible with only CSS?
Thanks.
Just use the adjacent sibling selector +
, you don't need the nth-child
selector:
.active + li {
color: red;
}
<ul>
<li class="active">Item</li>
<li>Item</li>
<li>Item</li>
</ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With