Problem: Mobile-First Responsive Grid
Problem description
Create a grid container that:
Shows a single column for viewports less than
400px.Shows two columns for viewports between
400pxand800px.Shows three columns for viewports
800pxand above.
Goal
Write CSS in styles.css with a mobile-first approach: start with one column by default, then add media queries at min-width: 400px and min-width: 800px to increase the number of columns.
Constraints
Use CSS Grid and JavaScript is not allowed.
Use exactly two media queries.
Columns must equally divide the available width.
Keep a
20pxgap between items.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.
Problem: Mobile-First Responsive Grid
Problem description
Create a grid container that:
Shows a single column for viewports less than
400px.Shows two columns for viewports between
400pxand800px.Shows three columns for viewports
800pxand above.
Goal
Write CSS in styles.css with a mobile-first approach: start with one column by default, then add media queries at min-width: 400px and min-width: 800px to increase the number of columns.
Constraints
Use CSS Grid and JavaScript is not allowed.
Use exactly two media queries.
Columns must equally divide the available width.
Keep a
20pxgap between items.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.