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?

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

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



Leave a Reply 2

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


Vinanti

Vinanti

D. div > h2{}