CSS Worksheet: Box Model
Code tip (Inside out, twice): From the inside out: content → padding → border → margin. Border to border = width + 2 × padding + 2 × border. Total space = width + 2 × padding + 2 × border + 2 × margin.
NameDateTime takenScore ___ / 40
-
1.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} -
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 4.Which of these is the border? (a) space outside the border (b) the line round the box (c) the text or picture (d) the gap to other boxes
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 7.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) content (d) border
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 1px solid black;
margin: 20px;
} -
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 10.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) padding (d) border
- 11.True or false: padding is space inside the border. (a) True (b) False
- 12.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) border (d) margin
-
13.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 25px;
border: 4px solid black;
margin: 0px;
} - 14.True or false: margin is the gap to other boxes. (a) False (b) True
- 15.True or false: the border is the line round the box. (a) False (b) True
- 16.Which of these is the border? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) space inside the border
-
17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 5px;
border: 5px solid black;
margin: 5px;
} -
18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 80px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} - 19.True or false: the content is the gap to other boxes. (a) True (b) False
-
20.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} -
21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 22.True or false: the border is the gap round content. (a) True (b) False
- 23.Which of these is margin? (a) space inside the border (b) the gap round content (c) a solid or dotted edge (d) space outside the border
- 24.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) margin (d) border
-
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} - 26.True or false: the border is a solid or dotted edge. (a) True (b) False
- 27.True or false: margin is the gap round content. (a) True (b) False
- 28.True or false: padding is the gap round content. (a) True (b) False
- 29.Which of these is margin? (a) the text or picture (b) a solid or dotted edge (c) the line round the box (d) the gap to other boxes
- 30.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
- 31.True or false: the border is space inside the border. (a) True (b) False
-
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 33.True or false: margin is space outside the border. (a) False (b) True
-
34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 60px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 35.Which of these is padding? (a) the line round the box (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} - 37.True or false: padding is the gap to other boxes. (a) True (b) False
- 38.True or false: the content is a solid or dotted edge. (a) False (b) True
- 39.True or false: padding is a solid or dotted edge. (a) False (b) True
- 40.True or false: the border is the gap to other boxes. (a) True (b) False
Answer key
- 202
- 180
- 160
- the line round the box
- 128
- 114
- margin
- 132
- 180
- padding
- True
- border
- 108
- True
- True
- a solid or dotted edge
- 90
- 122
- False
- 142
- 244
- False
- space outside the border
- margin
- 92
- True
- False
- True
- the gap to other boxes
- border
- False
- 194
- True
- 108
- space inside the border
- 288
- False
- False
- False
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids