Name

:first-of-type

Anwendbar auf:

Jedes Element

Beschreibung:

Wählt ein Element aus, wenn es das erste Kind seiner Art von einem anderen Element ist. So wählt div:first-of-type beispielsweise jedes div aus, das das erste Element vom Typ div unter den Kindelementen eines anderen Elements ist.

Beispiele:

td:first-of-type {border-left: 1px dotted;}
h2:first-of-type {color: fuchsia;}

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.