Recall & Review
beginner
What does the CSS selector
div > p select?It selects all
<p> elements that are direct children of a <div> element.Click to reveal answer
beginner
Explain the difference between
div p and div > p selectors.div p selects all <p> elements inside a <div>, no matter how deep.<br>div > p selects only <p> elements that are immediate children of the <div>.Click to reveal answer
intermediate
What does the selector
ul li:first-child target?It targets the first
<li> element inside each <ul> list.Click to reveal answer
intermediate
How does the adjacent sibling selector
h2 + p work?It selects the first
<p> element immediately following an <h2> element, only if they share the same parent.Click to reveal answer
intermediate
What is the purpose of the general sibling selector
h2 ~ p?It selects all
<p> elements that are siblings of an <h2> element and come after it, regardless of how many elements are in between.Click to reveal answer
Which selector matches all
<li> elements inside a <ul>, no matter how deeply nested?✗ Incorrect
ul li selects all <li> inside <ul> at any depth. ul > li only selects direct children.What does the selector
p:first-child select?✗ Incorrect
p:first-child selects <p> elements that are the very first child of their parent.Which selector selects only
<p> elements immediately after an <h1>?✗ Incorrect
h1 + p selects the <p> that comes right after an <h1> sibling.What does the selector
section > article.highlight select?✗ Incorrect
The > means direct children only, so it selects
<article> with class highlight that are immediate children of <section>.Which selector matches all siblings
<p> after an <h3>?✗ Incorrect
h3 ~ p selects all <p> siblings after <h3>, not just the immediate one.Describe how you would select all paragraphs that are direct children of a div using CSS selectors.
Think about the symbol that means 'direct child' in CSS.
You got /4 concepts.
Explain the difference between the adjacent sibling selector and the general sibling selector in CSS.
One selects only the next sibling, the other selects all siblings after.
You got /5 concepts.