Suggest an editImprove this articleRefine the answer for “What does :first-child do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`:first-child`** is a pseudo-class that selects an element that is the first child of its parent, regardless of tag type. **Key point:** it triggers only if the element is genuinely first among all siblings at its level, not merely first among elements of its own type.Shown above the full answer for quick recall.Answer (EN)Image`:first-child` is a pseudo-class that selects **the element that is the first child of its parent**. It only triggers if the element genuinely comes **first inside the container**, among all siblings at the same level. --- ### **Example** ```html <ul> <li>First</li> <li>Second</li> </ul> ``` ```css li:first-child { color: red; } ``` In this example, only the first `<li>` becomes red, because it is the first child element inside `ul`. --- ### **When :first-child will NOT work** If `li` is not first in the list: ```html <ul> <span></span> <li>Item</li> </ul> ``` Then `li:first-child` **will not apply**, because the first child is `span`. --- ### **Summary** `:first-child` selects only those elements that sit **in the first position inside their parent**. It depends on the HTML structure and does not look at the tag type, only the position in the tree matters.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.