Make #one red.
Acceptance criteria
- 1.Make #one red.
CSS Tutorial · CSS Selectors
These 10 tasks go with the CSS ID 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: “Understand how ID selectors target unique elements, why their high specificity is difficult to override, and when another selector is preferable.” Read the chapter.
1.Target an idexercise · easy · 10 min
Make #one red.
Passes when: Make #one red.
2.Border a single elementexercise · easy · 10 min · practice plan
Give #one a 4px solid border.
Passes when: Give #one a 4px solid border.
3.Combine id with elementexercise · easy · 10 min · practice plan
Target the div that has the id one.
Passes when: Target the div that has the id one.
4.Style a descendant of an idexercise · easy · 10 min · practice plan
Make the paragraph inside #one blue.
Passes when: Make the paragraph inside #one blue.
5.Beat a class ruleexercise · medium · 10 min · practice plan
The id rule should win over the class rule.
Passes when: The id rule should win over the class rule.
6.Fix the missing hashbug fix · easy · 8 min
An id selector needs a leading #.
Passes when: An id selector needs a leading #.
7.Fix the dot used for an idbug fix · easy · 8 min · practice plan
A dot targets a class, not an id.
Passes when: A dot targets a class, not an id.
8.Fix the id that does not existbug fix · easy · 8 min · practice plan
No element has the id "two".
Passes when: No element has the id "two".
9.Fix the missing descendant spacebug fix · easy · 8 min · practice plan
Without a space this looks for one element with both.
Passes when: Without a space this looks for one element with both.
10.Fix the class expected to beat the idbug fix · easy · 8 min · practice plan
An id always outranks a class.
Passes when: An id always outranks a class.
Between them these tasks cover ID selectors, Uniqueness and Specificity weight.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.