- Web design
- CSS
- Pseudo class
- here
last-child pseudo-class --Introduction to CSS [CSS3 compatible]
The last-child pseudo-class is a pseudo-class for styling the last sibling from the perspective of your parents. Often used in combination with the li tag.
- First
- Next
- Last
<style> .my_list li: last-child { background: #ddd; } </style> <div class = "my_list"> <ul> <li> First </li> <li> Next </li> <li> Last </li> </ul> </div>
The style is applied only to the first li tag.