0
0
CSSmarkup~20 mins

Mobile-first approach in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Mobile-first Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why use a mobile-first approach in CSS?
Which of the following best explains the main reason developers use a mobile-first approach when writing CSS?
AIt uses JavaScript to detect screen size and load styles dynamically.
BIt ensures styles for small screens load first, improving performance on mobile devices.
CIt applies desktop styles first, then overrides them for mobile devices.
DIt disables styles on mobile devices to save bandwidth.
Attempts:
2 left
💡 Hint
Think about which devices usually have slower connections and smaller screens.
📝 Syntax
intermediate
2:00remaining
Identify the correct mobile-first media query
Which CSS media query correctly follows the mobile-first approach to apply styles for screens wider than 600px?
A@media (max-width: 600px) { body { background: blue; } }
B@media screen and (min-device-width: 600px) { body { background: blue; } }
C@media (min-width: 600px) { body { background: blue; } }
D@media screen and (max-device-width: 600px) { body { background: blue; } }
Attempts:
2 left
💡 Hint
Mobile-first uses min-width to add styles for bigger screens.
rendering
advanced
2:00remaining
What background color will the page show on a 500px wide screen?
Given this CSS, what background color will the page have when viewed on a screen 500px wide?
CSS
body {
  background-color: white;
}

@media (min-width: 600px) {
  body {
    background-color: green;
  }
}

@media (min-width: 400px) {
  body {
    background-color: yellow;
  }
}
AYellow
BWhite
CGreen
DNo background color
Attempts:
2 left
💡 Hint
Check which media queries apply at 500px width.
selector
advanced
2:00remaining
Which CSS selector targets only mobile devices in a mobile-first approach?
You want to style a nav element only on screens smaller than 480px. Which CSS snippet correctly does this using a mobile-first approach?
Anav { font-size: 1.2rem; } @media (min-width: 480px) { nav { font-size: 1rem; } }
B@media (min-width: 480px) { nav { font-size: 1.2rem; } }
C@media (max-width: 479px) { nav { font-size: 1.2rem; } }
Dnav { font-size: 1rem; } @media (max-width: 479px) { nav { font-size: 1.2rem; } }
Attempts:
2 left
💡 Hint
Mobile-first means base styles for small screens, then bigger screen overrides.
accessibility
expert
3:00remaining
How does mobile-first CSS improve accessibility?
Which statement best explains how a mobile-first CSS approach can help users with disabilities?
AIt hides content on mobile devices to reduce cognitive load.
BIt disables animations on mobile devices to reduce distractions.
CIt automatically adds ARIA labels to all elements for screen readers.
DIt ensures simpler layouts and larger touch targets on small screens, aiding users with motor impairments.
Attempts:
2 left
💡 Hint
Think about how mobile design affects ease of use for everyone.