CSS3 :first-of-typeSelectors

Complete CSS Selector Reference Manual

Example

The selected p element is the first p element of its parent element:

p:first-of-type { background:#ff0000; }

Try it Yourself »

Definition and Usage

The :first-of-type selector matches an element that is the first child of a specific type within its parent.

Tip:It means the same as :nth-of-type(1).


Browser Support

The numbers in the table indicate the first browser version number that supports the property.

Selectors
:first-of-type 4.0 9.0 3.5 3.2 9.6

Complete CSS Selector Reference Manual

other extensions