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 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: 2px solid black;
margin: 0px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} -
3.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 260px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 4.📦 In the box model, which part is the text or picture? (a) content (b) padding (c) border (d) margin
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} - 6.Which of these is padding? (a) the text or picture (b) space inside the border (c) the gap to other boxes (d) a solid or dotted edge
-
7.📦 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: 3px solid black;
margin: 20px;
} -
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} - 9.Which of these is the content? (a) space inside the border (b) the text or picture (c) the gap round content (d) the gap to other boxes
- 10.📦 In the box model, which part is the line round the box? (a) border (b) content (c) margin (d) padding
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 12.True or false: margin is the line round the box. (a) True (b) False
-
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} -
14.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 15.True or false: the border is a solid or dotted edge. (a) True (b) False
-
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} -
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} -
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 25px;
border: 3px solid black;
margin: 5px;
} -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} - 20.True or false: padding is space outside the border. (a) False (b) True
-
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} - 22.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) the gap round content (d) the line round the box
-
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 24.True or false: margin is the gap to other boxes. (a) True (b) False
-
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 160px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} - 26.Which of these is padding? (a) the line round the box (b) the gap to other boxes (c) the gap round content (d) the text or picture
- 27.Which of these is the border? (a) a solid or dotted edge (b) the text or picture (c) the gap round content (d) the gap to other boxes
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} -
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 260px;
padding: 20px;
border: 2px solid black;
margin: 5px;
} - 30.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) padding (d) border
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 3px solid black;
margin: 5px;
} - 32.True or false: the content is space outside the border. (a) True (b) False
- 33.True or false: margin is space outside the border. (a) False (b) True
- 34.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) padding (d) border
- 35.True or false: margin is the text or picture. (a) False (b) True
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 37.True or false: padding is a solid or dotted edge. (a) False (b) True
- 38.True or false: the border is the line round the box. (a) False (b) True
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 5px;
border: 4px solid black;
margin: 15px;
}
Answer key
- 174
- 132
- 312
- content
- 174
- space inside the border
- 246
- 332
- the text or picture
- border
- 218
- False
- 82
- 242
- True
- 82
- 150
- 156
- 114
- False
- 140
- the line round the box
- 104
- True
- 182
- the gap round content
- a solid or dotted edge
- 246
- 304
- margin
- 256
- False
- True
- padding
- False
- 126
- False
- True
- 380
- 98
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids