Vidyalelo
CSS · Q15

CSS Selectors and CSS Files

Programming · CSS · question 15

Q15

Which of the following selector selects an element if it’s the only child of its parent?

A.
:root
B.
:nth-oftype(n)
C.
:only-child
Answer
D.
none of the mentioned

Answer: Option C

Solution

Answer: Option C
Solution:
Example: h1:only-child {color: blue;}