Mobile-first means writing CSS for small screens first. This helps pages load faster on phones and tablets because the browser applies simple styles first. Then, larger screen styles are added with media queries.
Mobile-first CSS writes base styles for small screens. Then it uses @media (min-width: 600px) to add or override styles for screens 600px wide or larger.
body {
background-color: white;
}
@media (min-width: 600px) {
body {
background-color: green;
}
}
@media (min-width: 400px) {
body {
background-color: yellow;
}
}Base background is white. The @media (min-width: 400px) applies at 500px, changing background to yellow. The @media (min-width: 600px) does not apply because 500px is less than 600px.
nav element only on screens smaller than 480px. Which CSS snippet correctly does this using a mobile-first approach?Option A sets the base font size for mobile (small screens). Then it uses @media (min-width: 480px) to reduce font size for bigger screens. This matches mobile-first principles.
Mobile-first design encourages simple layouts and bigger buttons for small screens. This helps users with motor difficulties by making controls easier to tap and content easier to read.