CSS :first-of-type Selector Last Updated : 29 Aug, 2024 Comments Improve Suggest changes 1 Likes Like Report The :first-of-type Selector is used to targeting the first child of every element of it's parent. if we want to style the first child of an element without giving a class, we can use it. Syntax::first-of-type { //property}Example: HTML <!DOCTYPE html> <html> <head> <style> p:first-of-type { background: limegreen; font-size: 4.0em; font-style: italic; } </style> </head> <body> <p>First child</p> <p>Second child.</p> <p>Third child.</p> <p>Fourth child.</p> </body> </html> Output: Supported Browsers:Google Chrome 1.0Edge 12.0Firefox 3.5Safari 3.1Opera 9.5 Create Quiz Comment V Vishal_Khoda Follow 1 Improve V Vishal_Khoda Follow 1 Improve Article Tags : Misc Web Technologies CSS CSS-Selectors Explore CSS Introduction 3 min read CSS Syntax 3 min read CSS Selectors 6 min read CSS Comments 2 min read CSS Colors 5 min read CSS Borders 5 min read CSS Margins 4 min read CSS Height and Width 4 min read CSS Outline 4 min read CSS Fonts 4 min read Like