Skip to content
Related Articles

Related Articles

What is first child in CSS ?

Improve Article
Save Article
  • Last Updated : 15 Mar, 2021
Improve Article
Save Article

The first-child is a pseudo class in CSS which represents the first element among a group of sibling elements. The :first-child Selector is used to target the first child element of it’s parent for styling.


:first-child {



<!DOCTYPE html> 
        p:first-child { 
            background: limegreen; 
            color: white; 
            font-style: italic; 
            font-size: 1.875em; 
    <p>I am first child.</p>
    <p>I am second child.</p>
    <p>I am third child.</p>
    <p>I am last child.</p>


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!