PrepAway - Latest Free Exam Questions & Answers

Which CSS3 code fragment styles an H2 element only if i…

Which CSS3 code fragment styles an H2 element only if it is a direct child of a DIV element?

PrepAway - Latest Free Exam Questions & Answers

A.
h2 > div {background-color: #900;}

B.
div, h2 {background-color: #900;}

C.
div {background-color: #900;}h2 {background-color: #900;}

D.
div > h2 {background-color: #900;}

Explanation:
https://www.w3.org/TR/CSS21/selector.html%23id-selectors

2 Comments on “Which CSS3 code fragment styles an H2 element only if i…


Leave a Reply