Problem: Dynamic Grid with Named Areas
Problem description
Design a grid layout with the following areas:
headerspanning full widthsidebaron the left ofmaincontentmaincontent areafooterspanning full width
Layout requirements are as follows:
Desktop (
viewport ≥ 1024px):sidebar (1fr)+main (3fr)in one row underheader,footerbelowTablet (
viewport ≥ 768px and < 1024px):sidebarabovemainin two rows, both full widthMobile (
viewport < 768px): Onlymaincontent,header, andfooter(hidesidebar)
Goal
Implement CSS rules in styles.css to define grid areas and media queries for three breakpoints, adjusting grid-template-areas, columns, and rows accordingly.
Constraints
Use CSS Grid with named areas.
Define three breakpoints:
<768px,768px–1023px, and≥1024px.Hide the sidebar on mobile.
Set the grid gap to
10px.
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: Dynamic Grid with Named Areas
Problem description
Design a grid layout with the following areas:
headerspanning full widthsidebaron the left ofmaincontentmaincontent areafooterspanning full width
Layout requirements are as follows:
Desktop (
viewport ≥ 1024px):sidebar (1fr)+main (3fr)in one row underheader,footerbelowTablet (
viewport ≥ 768px and < 1024px):sidebarabovemainin two rows, both full widthMobile (
viewport < 768px): Onlymaincontent,header, andfooter(hidesidebar)
Goal
Implement CSS rules in styles.css to define grid areas and media queries for three breakpoints, adjusting grid-template-areas, columns, and rows accordingly.
Constraints
Use CSS Grid with named areas.
Define three breakpoints:
<768px,768px–1023px, and≥1024px.Hide the sidebar on mobile.
Set the grid gap to
10px.
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.