What is the first of type selector in CSS?

​The :first-of-type selector is used to target the first child occurrence of every element of its parent. The first child of that particular element will adopt all of the properties.


Syntax

The syntax for the :first-of-type selector given below:

svg viewer

Examples

The code examples below show how the :first-of-type selector is used to manipulate the formatting properties that follow:

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved