Which selector targets an element only when it is the last child of its parent?
- A :first-child
- B :last-child
- C :nth-child(1)
- D :only-child
Answer
:last-child
:last-child matches the final child element. :only-child matches only when there are no siblings at all.





