Home > Software design >  Is there any way to select or target the last three lists? I have tried using child selector, but it
Is there any way to select or target the last three lists? I have tried using child selector, but it

Time:07-11

How to target the last 3 lists together? I have tried using child selectors, but it allows us to target only one element simultaneously.

How to target the last 3 lists together? I have tried using child selectors, but it allows to target only one element at a time.

CodePudding user response:

div > li:nth-last-child(-n 3) {
    background-color: aqua;
}
<div>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>

</div>  

  • Related