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: 90px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} - 2.Which of these is padding? (a) the text or picture (b) a solid or dotted edge (c) space outside the border (d) the gap round content
- 3.True or false: padding is space outside the border. (a) True (b) False
- 4.Which of these is the border? (a) space outside the border (b) the gap round content (c) a solid or dotted edge (d) the gap to other boxes
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 3px solid black;
margin: 20px;
} -
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 7.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) margin (d) content
- 8.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
-
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: 270px;
padding: 25px;
border: 5px solid black;
margin: 15px;
} - 10.True or false: margin is the gap round content. (a) True (b) False
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} - 13.True or false: the border is space outside the border. (a) False (b) True
- 14.True or false: margin is space inside the border. (a) True (b) False
-
15.📦 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: 0px;
} - 16.True or false: the content is the gap to other boxes. (a) False (b) True
- 17.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) space outside the border
- 18.True or false: the border is a solid or dotted edge. (a) True (b) False
-
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
20.📦 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: 20px;
border: 3px solid black;
margin: 20px;
} -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} -
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} -
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 15px;
border: 4px solid black;
margin: 5px;
} -
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} - 25.True or false: the content is the text or picture. (a) False (b) True
- 26.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
- 27.Which of these is margin? (a) the text or picture (b) the line round the box (c) the gap round content (d) the gap to other boxes
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} -
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: 250px;
padding: 30px;
border: 4px solid black;
margin: 0px;
} -
30.📦 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: 3px solid black;
margin: 15px;
} -
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: 290px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} - 33.True or false: padding is space inside the border. (a) True (b) False
- 34.Which of these is the content? (a) space outside the border (b) space inside the border (c) the gap to other boxes (d) the text or picture
-
35.📦 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: 20px;
border: 1px solid black;
margin: 20px;
} - 36.True or false: padding is the gap round content. (a) True (b) False
- 37.True or false: margin is the gap to other boxes. (a) False (b) True
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} - 39.True or false: margin is space outside the border. (a) False (b) True
- 40.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
Answer key
- 166
- the gap round content
- False
- a solid or dotted edge
- 156
- 242
- margin
- border
- 330
- False
- 214
- 292
- False
- False
- 150
- False
- space inside the border
- True
- 168
- 266
- 238
- 112
- 208
- 224
- True
- padding
- the gap to other boxes
- 140
- 318
- 86
- 350
- 272
- True
- the text or picture
- 92
- True
- True
- 112
- True
- margin
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids