Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 :first-of-type selector

CSS3 :first-of-type selector

Complete CSS SelectorComplete CSS Selector Reference Manual

Example

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

p

:first-of-type

{

background:

#ff0000

;

}

Try it »


Definition and Usage

: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 that supports this property.

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

Complete CSS SelectorComplete CSS Selector Reference Manual