0
0
CSSmarkup~10 mins

Grid rows and columns in CSS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a grid container with 3 columns.

CSS
.container {
  display: grid;
  grid-template-columns: [1];
}
Drag options to blanks, or click blank then click option'
Arepeat(3, 1fr)
Bflex
Cblock
Dinline-grid
Attempts:
3 left
💡 Hint
Common Mistakes
Using flex instead of grid for display.
Not specifying the number of columns correctly.
2fill in blank
medium

Complete the code to create 4 rows each 100 pixels tall.

CSS
.container {
  display: grid;
  grid-template-rows: [1];
}
Drag options to blanks, or click blank then click option'
A1fr 1fr 1fr 1fr
Bauto auto auto auto
Crepeat(2, 100px)
D100px 100px 100px 100px
Attempts:
3 left
💡 Hint
Common Mistakes
Using repeat(2, 100px) which creates only 2 rows.
Using auto which sizes rows automatically.
3fill in blank
hard

Fix the error in the code to properly define 2 columns and 3 rows.

CSS
.container {
  display: grid;
  grid-template-columns: [1];
  grid-template-rows: repeat(3, 50px);
}
Drag options to blanks, or click blank then click option'
Aauto auto auto
Brepeat(3, 1fr)
Crepeat(2, 1fr)
D50px 50px
Attempts:
3 left
💡 Hint
Common Mistakes
Using repeat(3, 1fr) which creates 3 columns instead of 2.
Using fixed pixel sizes for columns when flexible sizes are needed.
4fill in blank
hard

Fill both blanks to create a grid with 3 columns and 2 rows, each column 1fr and each row 150px tall.

CSS
.container {
  display: grid;
  grid-template-columns: [1];
  grid-template-rows: [2];
}
Drag options to blanks, or click blank then click option'
Arepeat(3, 1fr)
Brepeat(2, 150px)
Crepeat(3, 150px)
Drepeat(2, 1fr)
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the number of repeats for columns and rows.
Using pixel units for columns instead of fractions.
5fill in blank
hard

Fill all three blanks to create a grid with 4 columns of 1fr, 3 rows of 100px, and a gap of 10px between rows and columns.

CSS
.container {
  display: grid;
  grid-template-columns: [1];
  grid-template-rows: [2];
  gap: [3];
}
Drag options to blanks, or click blank then click option'
Arepeat(4, 1fr)
Brepeat(3, 100px)
C10px
D5px
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong repeat counts for columns or rows.
Setting gap to too small or wrong units.