exam questions

Exam 70-480 All Questions

View all questions & answers for the 70-480 exam

Exam 70-480 topic 4 question 7 discussion

Actual exam question from Microsoft's 70-480
Question #: 7
Topic #: 4
[All 70-480 Questions]

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");
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
The :first-of-type selector matches every element that is the first child, of a particular type, of its parent.
Reference: CSS3 :first-of-type Selector

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
BadBot
5 years, 1 month ago
After testing it appears to me both A and C works just fine.
upvoted 3 times
nelaed
4 years, 10 months ago
I have tested and this DOES NOT work $("section article:first-child").css("background-color", "red"); But this works perfectly. $("article:first-of-type").css("background-color", "red"); C is the right answer.
upvoted 1 times
...
nelaed
4 years, 10 months ago
first-child is for elements inside article tag.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...