Inside a #wrap rule, nest a p rule that colours the text blue.
Acceptance criteria
- 1.Inside a #wrap rule, nest a p rule that colours the text blue.
CSS Tutorial · Modern CSS Authoring
These 10 tasks go with the Nesting & Scope chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “Keep related selectors together with native nesting and limit selectors to a component subtree with @scope. The lesson compares native selector nesting with @scope, shows the parent selector, nested conditions, scope limits, and scoping proximity.” .
1.Nest a ruleexercise · easy · 10 min
Inside a #wrap rule, nest a p rule that colours the text blue.
Passes when: Inside a #wrap rule, nest a p rule that colours the text blue.
2.Nest without the ampersandexercise · easy · 10 min · practice plan
Nest a p rule directly, making it green.
Passes when: Nest a p rule directly, making it green.
3.Nest two levels deepexercise · easy · 10 min · practice plan
Nest p inside #wrap and make it purple.
Passes when: Nest p inside #wrap and make it purple.
4.Scope some stylesexercise · easy · 10 min · practice plan
Use @scope on #wrap to colour paragraphs teal.
Passes when: Use @scope on #wrap to colour paragraphs teal.
5.Nest a custom propertyexercise · medium · 10 min · practice plan
Set --tone on #wrap and use it in a nested p rule.
Passes when: Set --tone on #wrap and use it in a nested p rule.
6.Fix the nested rule with no bracesbug fix · easy · 8 min
A nested rule needs its own declaration block.
Passes when: A nested rule needs its own declaration block.
7.Fix the wrong nested selectorbug fix · easy · 8 min · practice plan
The nested rule targets the link instead of the paragraph.
Passes when: The nested rule targets the link instead of the paragraph.
8.Fix the misplaced ampersandbug fix · easy · 8 min · practice plan
The ampersand stands for the parent selector and comes first.
Passes when: The ampersand stands for the parent selector and comes first.
9.Fix the scope syntaxbug fix · easy · 8 min · practice plan
@scope takes its root in parentheses.
Passes when: @scope takes its root in parentheses.
10.Fix the variable declared too lowbug fix · easy · 8 min · practice plan
The custom property must be on the parent to be inherited.
Passes when: The custom property must be on the parent to be inherited.
Between them these tasks cover Nested rules, The & selector and @scope.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.