jquery - How we can add a class for the last three item only in a list group -


how can add class last 3 item in list group.

<ul>     <li>1</li>     <li>2</li>     <li>3</li>     <li>4</li>     <li>5</li>     <li>6</li>     <li class="last">7</li>     <li class="last">8</li>     <li class="last">9</li> </ul> 

li:nth-last-child(-n+3)  {   color: green;    } 

fiddle

check out in this mozilla article


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -