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: 150px;
padding: 5px;
border: 3px solid black;
margin: 0px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} -
4.📦 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: 30px;
border: 1px solid black;
margin: 15px;
} - 5.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
-
6.📦 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: 5px;
border: 3px solid black;
margin: 0px;
} -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} -
9.📦 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: 15px;
border: 3px solid black;
margin: 0px;
} - 10.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) content (d) margin
-
11.📦 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: 15px;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 13.Which of these is the content? (a) the gap to other boxes (b) space outside the border (c) space inside the border (d) the text or picture
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 15.Which of these is margin? (a) the text or picture (b) space inside the border (c) a solid or dotted edge (d) space outside the border
- 16.True or false: the border is the gap round content. (a) True (b) False
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 18.Which of these is padding? (a) the gap round content (b) the line round the box (c) the gap to other boxes (d) space outside the border
- 19.True or false: padding is the gap round content. (a) True (b) False
- 20.True or false: margin is space inside the border. (a) True (b) False
- 21.True or false: margin is the gap round content. (a) True (b) False
-
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: 80px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} - 23.True or false: padding is space inside the border. (a) True (b) False
- 24.True or false: padding is a solid or dotted edge. (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: 220px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} -
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} - 27.📦 In the box model, which part is the gap round content? (a) content (b) border (c) margin (d) padding
-
28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} -
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: 210px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 30.True or false: margin is the gap to other boxes. (a) False (b) True
-
31.📦 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: 5px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 33.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) content (d) padding
- 34.True or false: the content is the line round the box. (a) False (b) True
- 35.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) border (d) content
-
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} - 39.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) the gap to other boxes
- 40.📦 In the box model, which part is the text or picture? (a) content (b) border (c) margin (d) padding
Answer key
- 166
- 234
- 194
- 262
- border
- 96
- 252
- 378
- 236
- border
- 114
- 144
- the text or picture
- 260
- space outside the border
- False
- 370
- the gap round content
- True
- False
- False
- 150
- True
- False
- 242
- 218
- padding
- 278
- 224
- True
- 86
- 74
- padding
- False
- margin
- 228
- 244
- 224
- the gap to other boxes
- content
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids