Make both p and span red with one rule.
Acceptance criteria
- 1.Make both p and span red with one rule.
CSS Tutorial · CSS Selectors
These 10 tasks go with the CSS Group Selector 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: “Combine selectors into a selector list when several elements share declarations, while understanding how one invalid selector can affect the rule.” .
1.Group two elementsexercise · easy · 10 min
Make both p and span red with one rule.
Passes when: Make both p and span red with one rule.
2.Group a class and an idexercise · easy · 10 min · practice plan
Give .text and #one the same green colour.
Passes when: Give .text and #one the same green colour.
3.Group three selectorsexercise · easy · 10 min · practice plan
Zero the margin on div, p and span.
Passes when: Zero the margin on div, p and span.
4.Group with a shared borderexercise · easy · 10 min · practice plan
Give .card and .text a 2px solid border.
Passes when: Give .card and .text a 2px solid border.
5.Group then overrideexercise · medium · 10 min · practice plan
Group both blue, then make the span red.
Passes when: Group both blue, then make the span red.
6.Fix the missing commabug fix · easy · 8 min
Without a comma this becomes a descendant selector.
Passes when: Without a comma this becomes a descendant selector.
7.Fix the trailing commabug fix · easy · 8 min · practice plan
A dangling comma makes the whole selector list invalid.
Passes when: A dangling comma makes the whole selector list invalid.
8.Fix the invalid memberbug fix · easy · 8 min · practice plan
One bad selector in older engines can void the group — use valid ones.
Passes when: One bad selector in older engines can void the group — use valid ones.
9.Fix the duplicated rulesbug fix · easy · 8 min · practice plan
Three separate rules should be one group.
Passes when: Three separate rules should be one group.
10.Fix the group that lost a memberbug fix · easy · 8 min · practice plan
The span was dropped from the group.
Passes when: The span was dropped from the group.
Between them these tasks cover Comma-separated selectors and Sharing declarations.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.