At 500px wide, make #box red inside a max-width media query.
Acceptance criteria
- 1.At 500px wide, make #box red inside a max-width media query.
CSS Tutorial · CSS Reference
These 10 tasks go with the CSS At-rules 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: “A practical map of the at-rules used to import, condition, organize, animate, and describe CSS. The reference groups statement and block at-rules for imports, conditions, layers, scope, fonts, animation, properties, counters, and paged output.” .
1.Style below a widthexercise · easy · 10 min
At 500px wide, make #box red inside a max-width media query.
Passes when: At 500px wide, make #box red inside a max-width media query.
2.Style above a widthexercise · easy · 10 min · practice plan
The preview is 500px, so a min-width of 400px matches. Make #box green there.
Passes when: The preview is 500px, so a min-width of 400px matches. Make #box green there.
3.Feature detectionexercise · easy · 10 min · practice plan
Use @supports to apply a grid display.
Passes when: Use @supports to apply a grid display.
4.Two conditionsexercise · easy · 10 min · practice plan
Apply padding only between 400px and 600px.
Passes when: Apply padding only between 400px and 600px.
5.A responsive cardexercise · medium · 10 min · practice plan
Below 600px give the card padding and a border.
Passes when: Below 600px give the card padding and a border.
6.Fix the missing at-signbug fix · easy · 8 min
A media rule starts with @media.
Passes when: A media rule starts with @media.
7.Fix the query that never matchesbug fix · easy · 8 min · practice plan
The preview is 500px wide, so a min-width of 900px is wrong here.
Passes when: The preview is 500px wide, so a min-width of 900px is wrong here.
8.Fix the missing bracesbug fix · easy · 8 min · practice plan
A rule inside a media query still needs its own block.
Passes when: A rule inside a media query still needs its own block.
9.Fix the wrong combinerbug fix · easy · 8 min · practice plan
Two conditions are joined with and, not a comma.
Passes when: Two conditions are joined with and, not a comma.
10.Fix the border missing from the querybug fix · easy · 8 min · practice plan
The card is padded but never bordered.
Passes when: The card is padded but never bordered.
Between them these tasks cover @media, @supports and @font-face.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.