This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

:last-child

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨июль 2015 г.⁩.

* Some parts of this feature may have varying levels of support.

Описание

CSS псевдокласс :last-child находит любой элемент, являющийся последним в его родителе.

Синтаксис

element:last-child { style properties } 

Пример

HTML

html
<ul> <li>Этот элемент не лаймовый.</li> <li>И этот тоже.</li> <li>А этот да! :)</li> </ul> 

CSS

css
li:last-child { background-color: lime; } 

Спецификации

Specification
Selectors Level 4
# the-last-child-pseudo

Совместимость с браузерами

Смотрите также