CSS Grid container, online
Six activities your students do on their own devices. See who's finished, and their scores.
CSS Grid container in one minute
What students need to know
Combining repeat with the fr unit allocates equivalent sizing blocks efficiently. grid-template-rows measures explicit layout sizes vertically for stacking row bands.
display: grid is the standard value that makes an element a block-level grid layout container. Track listings are space-separated lists in CSS Grid, like 1fr 200px 1fr.
Mistakes students make
- The selector is missing a class dot prefix or tag definition. To target a class named grid-container, use .grid-container.
- The value true-grid is invalid. To activate the layout context, use display: grid.
- Grid track definitions should be separated by standard spaces, not commas.
- The property name is grid-template-rows, not grid-rows-template.
What students will learn in this module
Every question in Module 56
Quick questions
- Which declaration initializes a block-level grid container?Adisplay: grid-container;Bdisplay: grid;
- How should you separate multiple column sizes in grid-template-columns?AWith spacesBWith commas
- Which property acts as a modern shorthand to set spacing between both rows and columns?Agrid-spacingBgap
- What unit represents an automatic fractional share of available space inside a grid container?AfrBgr
- Is it valid to mix fixed units like pixels with relative units like fr inside track layouts?AYesBNo
Key terms
Students type the meaning of:
display: grid
Match the pairs
.container {
display: grid;
}Match it to what it does.container {
gap: 20px;
}Match it to what it doesCreates three parallel vertical columns of equal width distributions.Match it to what it doesEstablishes a horizontal structural framework with two rows.Match it to what it does.container {
grid-template-columns: 1fr, 1fr;
}Match it to what it does.container {
display: box-grid;
}Match it to what it doesFill in the blanks
.wrapper { _______: grid; }Hint: Type the property name used to turn an element into a grid container
.container { display: grid; _____________________: 200px 1fr; }Hint: Type the property used to define the tracks of your grid columns
.board { display: grid; __________________: 100px auto; }Hint: Type the property used to establish horizontal track rows
.gallery { display: grid; ___: 15px; }Hint: Type the shorthand property that defines space between grid cells
.layout { display: grid; grid-template-columns: repeat(3, ___); }Hint: Type the fractional unit keyword to make columns take equal shares
Spot the error
Question 1
Agrid-container {B display: grid;C gap: 10px;D}
Question 2
A.main-grid {B display: true-grid;C gap: 20px;D}
Question 3
A.container {B display: grid;C grid-template-columns: 100px, 1fr, 100px;D}
Question 4
A.dashboard {B display: grid;C grid-template-columns: 1fr 1fr;D grid-rows-template: repeat(2, 1fr);E}
Question 5
A.menu {B display: grid;C grid-template-columns: 200px 1fr;D row-space: 15px;E}
