Problem: Masonry-Style Responsive Grid
Problem description
Create a grid container that:
Displays items in a masonry-like layout.
Packs items densely to fill gaps (
grid-auto-flow: dense).Adjusts number of columns based on viewport:
2columns on mobile (<600px),3on tablet (600px–900px), and5on desktop (>900px).
Each grid item has a custom grid-row: span N defined via inline style or class, determining its height.
Goal
Write CSS in styles.css to configure the grid container and items for a masonry-style layout using CSS Grid only.
Constraints
Use CSS Grid with
grid-auto-flow: dense.Three breakpoints:
<600px,600px–900px,>900px.Gap: 10px.
Item heights vary via
grid-row: span N.
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: Masonry-Style Responsive Grid
Problem description
Create a grid container that:
Displays items in a masonry-like layout.
Packs items densely to fill gaps (
grid-auto-flow: dense).Adjusts number of columns based on viewport:
2columns on mobile (<600px),3on tablet (600px–900px), and5on desktop (>900px).
Each grid item has a custom grid-row: span N defined via inline style or class, determining its height.
Goal
Write CSS in styles.css to configure the grid container and items for a masonry-style layout using CSS Grid only.
Constraints
Use CSS Grid with
grid-auto-flow: dense.Three breakpoints:
<600px,600px–900px,>900px.Gap: 10px.
Item heights vary via
grid-row: span N.
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.