CSS ID Selector — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS ID Selector 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
Target an id
easy10 minMake #one red.
- 2
Border a single element
easy10 minGive #one a 4px solid border.
- 3
Combine id with element
easy10 minTarget the div that has the id one.
- 4
Style a descendant of an id
easy10 minMake the paragraph inside #one blue.
- 5
Beat a class rule
medium10 minThe id rule should win over the class rule.
Find the bug(5)
- 1
Fix the missing hash
easy8 minAn id selector needs a leading #.
- 2
Fix the dot used for an id
easy8 minA dot targets a class, not an id.
- 3
Fix the id that does not exist
easy8 minNo element has the id "two".
- 4
Fix the missing descendant space
easy8 minWithout a space this looks for one element with both.
- 5
Fix the class expected to beat the id
easy8 minAn id always outranks a class.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace