CSS Combinators — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Combinators lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Use a descendant combinator
easy10 minMake paragraphs inside .card red.
- 2
Use a child combinator
easy10 minTarget only direct paragraph children of #one.
- 3
Use an adjacent sibling
easy10 minStyle the span immediately after the paragraph.
- 4
Use a general sibling
easy10 minStyle every span that follows a paragraph.
- 5
Combine two combinators
medium10 minTarget a span that is a direct child of #one and follows a p.
Find the bug(5)
- 1
Fix the child combinator used for a descendant
easy8 minThe paragraph is not a direct child in every card.
- 2
Fix the missing combinator
easy8 minTwo selectors with no space target one element with both.
- 3
Fix the wrong sibling symbol
easy8 minAn adjacent sibling uses +, not -.
- 4
Fix the reversed sibling order
easy8 minThe span comes after the paragraph, not before.
- 5
Fix the over-nested selector
easy8 minThe span is a sibling of the paragraph, not inside it.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace