Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

first of type

The first-of-type structural pseudo-class selector is used to target and style the first occurrence of the specified element where it nests with its siblings. It is the same as using nth-of-type(1).
Syntax Logicelement:first-of-type { property_list }

CSS Code Example

<style> li:first-of-type { color: red; } </style> <ol> <li>List item</li> <li>List item</li> <li>List item</li> <li>List item</li> </ol> <ol> <li>List item</li> <li>List item</li> <li>List item</li> <li>List item</li> </ol>

CSS

Selectors

universaltypecompoundclassidnotattributedescendantchildadjacent siblinggeneral siblingfirst childlast childonly childfirst of typelast of typeonly of typenth childnth last childnth of typenth last of typeemptyrootfirst linefirst letterbeforeafterlinkvisitedhoveractivefocustargetenableddisabledcheckedlang