Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Combinator and grouping selectors worksheet is part of the HTML and CSS Journey journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1div p | Ah2 + p | |
| 2h1, h2, h3 | BApplies one shared rule to h1, h2 and h3 (grouping) | |
| 3Selects only the direct child elements of a parent | Cul > li | |
| 4Selects the element immediately after a sibling | DSelects every <p> nested inside a <div> at any depth (descendant) | |
| 5div > > p { } | EThe adjacent sibling combinator + is repeated; use a single + like 'h2 + p' | |
| 6h2 + + p { } | FThe child combinator > is doubled; use a single > like 'div > p' |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
div p — A space combinator like 'div p' targets every p inside a div. Combinators (space, >, +, ~) select by relationship; a comma groups selectors so several share one rule.div > p {
color: red;
}h1 + p {
margin: 0;
}h1, h2, h3 {
color: teal;
}h2 ~ p {
color: gray;
}header a, footer > a {
color: navy;
}