Challenge - 5 Problems
Grid Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ layout
intermediate2:00remaining
What is the number of columns in this grid container?
Consider the following CSS code for a grid container. How many columns will the grid have?
CSS
display: grid; grid-template-columns: repeat(3, 1fr);
Attempts:
2 left
💡 Hint
The repeat function sets how many columns are created.
✗ Incorrect
The property grid-template-columns: repeat(3, 1fr) creates 3 equal columns in the grid container.
❓ selector
intermediate2:00remaining
Which CSS property makes an element a grid container?
You want to turn a
into a grid container. Which CSS property and value should you use?
Attempts:
2 left
💡 Hint
The display property controls the layout type of an element.
✗ Incorrect
Setting display: grid; makes the element a grid container, enabling grid layout for its children.
❓ rendering
advanced2:30remaining
What will be the width of each column in this grid container?
Given this CSS, what is the width of each column if the container is 600px wide?
CSS
display: grid; grid-template-columns: 100px 2fr 1fr;
Attempts:
2 left
💡 Hint
fr units divide remaining space proportionally after fixed widths.
✗ Incorrect
The first column is fixed 100px. Remaining space is 500px (600-100). 2fr + 1fr = 3fr total. So 2fr = 2/3 * 500 = 333.33px, 1fr = 1/3 * 500 = 166.67px.
❓ accessibility
advanced2:00remaining
Which practice improves accessibility for grid containers?
When using CSS grid for layout, which practice helps screen reader users understand the page structure better?
Attempts:
2 left
💡 Hint
Screen readers rely on meaningful HTML tags.
✗ Incorrect
Using semantic elements like , , inside grid containers helps screen readers understand content roles and structure.
🧠 Conceptual
expert3:00remaining
What happens if you set grid-template-columns: auto auto auto; on a grid container with three items of different content widths?
Consider a grid container with three items. The CSS is:
grid-template-columns: auto auto auto;
What will be the width of each column?
Attempts:
2 left
💡 Hint
The auto keyword sizes columns based on content.
✗ Incorrect
Using auto for columns means each column's width fits its widest content, so columns can have different widths.