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
  .my_list li: last-child {
    background: #ddd;

<div class = "my_list">
    <li> First </li>
    <li> Next </li>
    <li> Last </li>

The style is applied only to the first li tag.

Associated Information