LinkedIn CSS Skill Assessment Quiz Answers

There are two sibling combinators that can be used to select elements contained within the same parent element; the general sibling combinator (~) and the adjacent sibling combinator (+). Referring to example below, which elements will the styles be applied to?

Latest Update on 23rd March, 2022 by Certification Course Answers

There are two sibling combinators that can be used to select elements contained within the same parent element; the general sibling combinator (~) and the adjacent sibling combinator (+). Referring to example below, which elements will the styles be applied to?

h2 ~ p {
  color: blue;
}
h2 + p {
  background: beige;
}
<section>
  <p>paragraph 1</p>
  <h2>Heading</h2>
  <p>paragraph 2</p>
  <p>paragraph 3</p>
</section>
  •  Paragraphs 2 and 3 will be blue. The h2 and paragraph 2 will have a beige background.
  •  Paragraphs 2, and 3 will be blue, and paragraph 2 will have a beige background.
  •  Paragraph 2 will be blue. Paragraphs 2 and 3 will have a beige background.

Correct Answer:

  •  Paragraphs 2, and 3 will be blue, and paragraph 2 will have a beige background.

Latest Updates

No posts found in this category.