# last-child pseudo-class

The `last-child` pseudo-class selects an element that is the last child of its parent.

## Syntax

`selector:last-child { }`

## Example

In this example, we will make the one `li` that is the last child of its parent (the last inside `ol`) red:

`<ul> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> </ul>` `li:last-child { color: red; }`

:

← →
↑
en ru