Name
:first-child
Anwendbar auf:
Jedes Element
Beschreibung:
Wählt ein Element aus, wenn es das erste Kind eines anderen
Elements ist. So wählt div:first-child
beispielsweise jedes
div
aus, das das erste Kind eines
anderen Elements ist, und nicht das erste
Kindelement von jedem div
.
Beispiele:
td:first-child {border-left: 1px solid;} p:first-child {text-indent: 0; margin-top: 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.