CSS Media Queries — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Media Queries 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
Write your first media query
easy10 minBelow 600px, make #text 14px.
- 2
Override a base rule
easy10 min#text is 30px by default; shrink it to 14px below 600px.
- 3
Target a media type
easy10 minOn screens narrower than 600px, make #text red.
- 4
Use range syntax
easy10 minUsing the modern range form, make #text blue at 600px and below.
- 5
Query the orientation
medium10 minIn portrait, make #text green.
Find the bug(5)
- 1
Fix the rule leaking to phones
easy8 minThe 30px desktop size should only apply from 700px up, leaving phones at the default 16px.
- 2
Fix the inverted breakpoint
easy8 minmin-width targets wide screens; this rule is meant for narrow ones.
- 3
Fix the breakpoint with no unit
easy8 minA breakpoint needs a unit, or the whole query is invalid.
- 4
Fix the missing at-sign
easy8 minThe rule is @media.
- 5
Fix the missing and
easy8 minA media type and a feature must be joined with `and`.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace