Which pseudo-class in CSS is used to target elements based on their position in a parent element, like the first child?

  • :element-first
  • :first-child
  • :nth-element(1)
  • :parent
The :first-child pseudo-class in CSS is used to target elements that are the first child of their parent element. It is commonly used to apply styles to the first element in a list or container. This selector is useful for creating specific styles for the first child within a parent.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *