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.Which of these is margin? (a) the line round the box (b) the gap round content (c) space outside the border (d) the text or picture
-
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: 200px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} - 4.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space outside the border (d) space inside the border
- 5.📦 In the box model, which part is space outside the border? (a) margin (b) padding (c) border (d) content
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 2px solid black;
margin: 5px;
} -
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 1px solid black;
margin: 0px;
} - 8.Which of these is padding? (a) the gap to other boxes (b) the line round the box (c) the gap round content (d) space outside the border
-
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} - 11.Which of these is the content? (a) space outside the border (b) the gap round content (c) space inside the border (d) the text or picture
- 12.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) margin (d) content
-
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: 60px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} - 14.True or false: the content is the gap to other boxes. (a) False (b) True
-
15.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} -
16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
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: 130px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
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: 170px;
padding: 15px;
border: 3px solid black;
margin: 0px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} - 20.📦 In the box model, which part is the line round the box? (a) content (b) border (c) padding (d) margin
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} -
22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} -
23.📦 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: 30px;
border: 4px solid black;
margin: 20px;
} -
24.📦 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: 15px;
border: 2px solid black;
margin: 5px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} - 26.True or false: padding is space inside the border. (a) False (b) True
-
27.📦 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: 10px;
border: 3px solid black;
margin: 15px;
} -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 29.True or false: margin is the gap to other boxes. (a) True (b) False
- 30.True or false: margin is space outside the border. (a) False (b) True
- 31.True or false: the content is the text or picture. (a) True (b) False
-
32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 33.Which of these is the border? (a) the gap round content (b) space inside the border (c) space outside the border (d) the line round the box
-
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: 80px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} -
35.📦 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: 20px;
} -
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} - 37.True or false: padding is a solid or dotted edge. (a) False (b) True
- 38.True or false: padding is the gap round content. (a) True (b) False
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 40.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
Answer key
- space outside the border
- 244
- 142
- a solid or dotted edge
- margin
- 234
- 242
- the gap round content
- 196
- 224
- the text or picture
- margin
- 98
- False
- 268
- 172
- 214
- 206
- 186
- border
- 184
- 166
- 118
- 104
- 116
- True
- 86
- 336
- True
- True
- True
- 142
- the line round the box
- 138
- 112
- 244
- False
- True
- 352
- content
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids