CSS Worksheet: Flexbox Basics
Code tip (Find the free space): Free space = container width − number of boxes × box width. flex-start: all free space after the last box; flex-end: all before the first box; center: half on each side. space-between: free space ÷ (boxes − 1) between each pair, none at the ends.
NameDateTime takenScore ___ / 40
- 1.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
- 2.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) flex-direction (c) justify-content (d) gap
- 3.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
-
4.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 2 boxes, each 80px wide (no margins). - 5.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
-
6.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 300px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 7.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) flex-direction (d) justify-content
-
8.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). -
9.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). -
10.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 240px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). -
11.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 230px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). -
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 210px;
justify-content: space-between;
}
Inside are 3 boxes, each 50px wide (no margins). - 13.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) display: flex (d) gap
- 14.💪 Which flexbox property turns on flexbox? (a) gap (b) align-items (c) display: flex (d) flex-direction
-
15.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 3 boxes, each 100px wide (no margins). -
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 190px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). -
17.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). - 19.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
- 20.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) flex-end (d) space-between
-
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 2 boxes, each 80px wide (no margins). -
22.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 160px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). -
23.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). -
24.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 470px;
justify-content: flex-end;
}
Inside are 4 boxes, each 100px wide (no margins). - 25.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) flex-end (d) space-between
-
26.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). -
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). -
28.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
29.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). -
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 390px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). -
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). -
32.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 110px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). -
34.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). - 35.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) display: flex (d) justify-content
-
36.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
37.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). -
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 39.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
-
40.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins).
Answer key
- puts boxes in the middle
- justify-content
- equal gaps, none at ends
- 50
- packs boxes at the start
- 60
- gap
- 30
- 30
- 80
- 30
- 30
- align-items
- display: flex
- 60
- 40
- 60
- 60
- packs boxes at the end
- flex-end
- 70
- 80
- 40
- 70
- flex-start
- 50
- 80
- 20
- 70
- 70
- 40
- 10
- 40
- 30
- flex-direction
- 30
- 30
- 70
- center
- 10
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids