Nesting & Scope — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the Nesting & Scope 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
Nest a rule
easy10 minInside a #wrap rule, nest a p rule that colours the text blue.
- 2
Nest without the ampersand
easy10 minNest a p rule directly, making it green.
- 3
Nest two levels deep
easy10 minNest p inside #wrap and make it purple.
- 4
Scope some styles
easy10 minUse @scope on #wrap to colour paragraphs teal.
- 5
Nest a custom property
medium10 minSet --tone on #wrap and use it in a nested p rule.
Find the bug(5)
- 1
Fix the nested rule with no braces
easy8 minA nested rule needs its own declaration block.
- 2
Fix the wrong nested selector
easy8 minThe nested rule targets the link instead of the paragraph.
- 3
Fix the misplaced ampersand
easy8 minThe ampersand stands for the parent selector and comes first.
- 4
Fix the scope syntax
easy8 min@scope takes its root in parentheses.
- 5
Fix the variable declared too low
easy8 minThe custom property must be on the parent to be inherited.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace