Question about CSS-rules


#1

Hi! I am doing a different online course (my apologies if this post doesnt belong here) and in one of the Quizzes I was asked this question:


Given the following HTML code:

<div>
  <div>
    <div class="makeMeBlue">
      <p>I am feeling blue</p>
    </div>
  </div>
  <section class="makeMeBlue">
    <p>I just want to be left alone!</p>
  </section>
</div>

Which of the following CSS rules turns the text of the first tag blue, but NOT the second tag?

1.

.makeMeBlue > p {
  color: blue;
}

2.

div.makeMeBlue p {
  color: blue;
}

3.

div > div > p {
  color: blue;
}

4.

div p {
  color: blue;
}

Now, the right answers are number 2 and 3 but I am a little unsure about number 3.
Shouldnt the correct answer need another div because the paragraph is wrapped up in 3 div-tags? Does it include all div > div > p even though the parent div is a child of another div?


#2

Nevermind, don't know why I just didn't test it myself straight away..


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.