You develop an HTML5 webpage. You have the following HTML markup:
You need to add a background color to the first article in each section.
Which code segment should you add to the webpage?
A.
$ (“section article:first-child”).css(“background-color”, “#f2f2f2”);
B.
$ (“section:first-child”).css ( “background-color”, “#f2f2f2”);
C.
$ (“article:first-of-type”) .css(“background-color”, “#f2f2f2”);
D.
$ (“section:first-of-type”).css(“background-color”, “#f2f2f2”);
Explanation:
The :first-of-type selector matches every element that is the first child, of a particular type, of its parent.
CSS3 :first-of-type Selector