Name

:last-child

Anwendbar auf:

Jedes Element

Beschreibung:

Wählt ein Element aus, wenn es das letzte Kind eines anderen Elements ist. So wählt div:last-child beispielsweise jedes div aus, das das letzte Kind eines anderen Elements ist, und nicht das letzte Kindelement von jedem div.

Beispiele:

td:last-child {border-right: 1px solid;}
p:last-child {margin-bottom: 2em;}

Get CSS kurz & gut, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.