CSS Pseudo Classes — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Pseudo Classes 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
Style the first child
easy10 minMake the first .card red using :first-child.
- 2
Style by position
easy10 minUse :nth-child(1) to target the first card.
- 3
Exclude with :not()
easy10 minColour every div that is not #one blue.
- 4
Style the first of a type
easy10 minTarget the first paragraph inside #one.
- 5
Combine two pseudo-classes
medium10 minTarget the first child that is not a paragraph.
Find the bug(5)
- 1
Fix the single colon count
easy8 minPseudo-classes use one colon, but this one is misspelled.
- 2
Fix the zero-based index
easy8 min:nth-child() counts from 1, not 0.
- 3
Fix the inverted :not()
easy8 minThis excludes the wrong element.
- 4
Fix the wrong element targeted
easy8 minThe rule picks the span; the first paragraph was intended.
- 5
Fix the double colon
easy8 minA double colon marks a pseudo-element, not a pseudo-class.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace