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: 140px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} - 2.True or false: padding is the gap round content. (a) True (b) False
- 3.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) border (d) padding
- 4.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
- 5.True or false: the content is the text or picture. (a) True (b) False
-
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} - 7.True or false: padding is space inside the border. (a) True (b) False
- 8.True or false: margin is space outside the border. (a) True (b) False
- 9.Which of these is the content? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) space inside the border
- 10.Which of these is padding? (a) the text or picture (b) the gap round content (c) the gap to other boxes (d) the line round the box
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 13.True or false: the content is the gap to other boxes. (a) True (b) False
-
14.📦 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: 20px;
border: 2px solid black;
margin: 10px;
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} -
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: 110px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} - 18.True or false: padding is the text or picture. (a) True (b) False
- 19.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) padding (d) border
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} - 21.True or false: margin is space inside the border. (a) False (b) True
-
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: 50px;
padding: 20px;
border: 5px solid black;
margin: 0px;
} - 23.Which of these is padding? (a) space inside the border (b) a solid or dotted edge (c) the text or picture (d) the gap to other boxes
- 24.True or false: the border is a solid or dotted edge. (a) False (b) True
- 25.True or false: the content is space inside the border. (a) True (b) False
- 26.Which of these is margin? (a) the line round the box (b) the text or picture (c) a solid or dotted edge (d) space outside the border
-
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 28.True or false: margin is the gap to other boxes. (a) False (b) True
- 29.True or false: margin is the gap round content. (a) False (b) True
-
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: 190px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} - 31.True or false: the content is space outside the border. (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: 170px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} -
33.📦 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: 1px solid black;
margin: 15px;
} -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 20px;
border: 3px solid black;
margin: 10px;
} - 35.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
- 36.📦 In the box model, which part is the gap to other boxes? (a) border (b) content (c) padding (d) margin
-
37.📦 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: 10px;
border: 1px solid black;
margin: 0px;
} -
38.📦 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: 1px solid black;
margin: 15px;
} -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} -
40.📦 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: 4px solid black;
margin: 15px;
}
Answer key
- 232
- True
- padding
- margin
- True
- 128
- True
- True
- the text or picture
- the gap round content
- 212
- 220
- False
- 254
- 296
- 234
- 138
- False
- border
- 210
- False
- 100
- space inside the border
- True
- False
- space outside the border
- 192
- True
- False
- 254
- False
- 208
- 112
- 276
- content
- margin
- 232
- 262
- 212
- 168
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids