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:

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved