0
0
CSSmarkup~20 mins

Grid container in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Grid Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
layout
intermediate
2: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);
A1
B2
C3
D4
Attempts:
2 left
💡 Hint
The repeat function sets how many columns are created.
selector
intermediate
2: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?
Adisplay: flex;
Bdisplay: block;
Cposition: grid;
Ddisplay: grid;
Attempts:
2 left
💡 Hint
The display property controls the layout type of an element.
rendering
advanced
2: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;
A100px, 333.33px, 166.67px
B100px, 200px, 300px
C100px, 400px, 100px
D100px, 250px, 250px
Attempts:
2 left
💡 Hint
fr units divide remaining space proportionally after fixed widths.
accessibility
advanced
2: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?
AUse semantic HTML elements inside the grid container.
BAdd tabindex="-1" to all grid items.
CUse only div elements with no ARIA roles.
DAvoid using grid-template-areas.
Attempts:
2 left
💡 Hint
Screen readers rely on meaningful HTML tags.
🧠 Conceptual
expert
3: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?
AAll columns have equal width regardless of content.
BEach column width matches the widest content in that column.
CColumns shrink to zero width if content is small.
DColumns ignore content size and fill container equally.
Attempts:
2 left
💡 Hint
The auto keyword sizes columns based on content.