Challenge - 5 Problems
Grid Template Areas Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Understanding grid-template-areas layout
Given the following CSS grid template areas, how many grid cells does the area named header cover?
CSS
grid-template-areas: "header header header" "nav main main" "nav footer footer";
Attempts:
2 left
💡 Hint
Count how many times the name 'header' appears in the grid-template-areas string.
✗ Incorrect
The 'header' area appears three times in the first row, so it covers 3 grid cells horizontally.
📝 Syntax
intermediate1:30remaining
Identify the syntax error in grid-template-areas
Which option contains a syntax error in the
grid-template-areas property?Attempts:
2 left
💡 Hint
Ensure all row strings have the same number of space-separated area names.
✗ Incorrect
Option A is invalid because the first row has 2 area names ("header header") while the second has 3 ("nav main footer"). All rows in grid-template-areas must have the same number of space-separated area names to define a rectangular grid.
❓ rendering
advanced2:00remaining
Visual layout from grid-template-areas
What will be the visual layout of the grid areas if the CSS is:
Which area will be the widest?
grid-template-columns: 1fr 2fr 1fr; grid-template-rows: 50px 100px; grid-template-areas: "a a b" "c d d";
Which area will be the widest?
Attempts:
2 left
💡 Hint
Look at how many columns each area covers and their relative widths.
✗ Incorrect
Area 'a' spans the first two columns: 1fr + 2fr = 3fr total width, which is wider than any other area.
❓ selector
advanced1:30remaining
Selecting grid areas with CSS selectors
Given this HTML and CSS, which selector correctly styles the grid area named 'sidebar'?
CSS
<div class="container"> <div class="header">Header</div> <div class="sidebar">Sidebar</div> <div class="content">Content</div> </div> .container { display: grid; grid-template-areas: "header header" "sidebar content"; } .sidebar { /* Which selector targets this grid area? */ }
Attempts:
2 left
💡 Hint
The grid-area property assigns the grid area name to the element.
✗ Incorrect
The element with class 'sidebar' should have grid-area: sidebar; to match the grid-template-areas name.
❓ accessibility
expert2:00remaining
Accessibility considerations with grid-template-areas
When using
grid-template-areas for layout, which practice best supports screen reader users?Attempts:
2 left
💡 Hint
Think about how screen readers understand page structure beyond visual layout.
✗ Incorrect
Using semantic HTML and ARIA roles helps screen readers understand the layout and purpose of each area, improving accessibility.