VOOZH about

URL: https://www.geeksforgeeks.org/css/css-first-child-selector/

⇱ CSS First Child Selector - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS First Child Selector

Last Updated : 12 Sep, 2024

CSS :first-child selector is used to select the elements that are the first child of the parent element.

Syntax:

:first-child {
 /* CSS property */
}

Example 1: This example shows the use of the CSS first child selector.

Output:

👁 Image


Example 2: This example shows the use of the CSS first child selector.

Output:

👁 Image

Supported Browsers:

  • Apple Safari 3.1 and above
  • Google Chrome 4.0 and above
  • Edge 12.0 and above
  • Firefox 3.0 and above
  • Opera 9.5 and above
Comment
Article Tags: