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 across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} - 2.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) content (d) margin
- 3.True or false: padding is the gap to other boxes. (a) True (b) False
-
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: 160px;
padding: 20px;
border: 4px solid black;
margin: 15px;
} -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} - 6.📦 In the box model, which part is the gap to other boxes? (a) margin (b) padding (c) content (d) border
- 7.True or false: the border is a solid or dotted edge. (a) False (b) True
-
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} - 9.Which of these is padding? (a) space outside the border (b) the text or picture (c) the gap round content (d) the gap to other boxes
- 10.Which of these is margin? (a) the line round the box (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
- 11.True or false: padding is space outside the border. (a) False (b) True
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} - 13.True or false: the content is the gap to other boxes. (a) True (b) False
- 14.Which of these is margin? (a) the gap round content (b) space outside the border (c) the line round the box (d) space inside the border
- 15.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) the text or picture (d) space outside the border
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 17.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) margin (d) border
- 18.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) border (d) content
-
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 5px;
border: 5px solid black;
margin: 10px;
} - 20.📦 In the box model, which part is space outside the border? (a) margin (b) padding (c) content (d) border
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} - 22.True or false: margin is the text or picture. (a) False (b) True
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} -
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} - 26.Which of these is the content? (a) space inside the border (b) the gap round content (c) the line round the box (d) the text or picture
-
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 30px;
border: 2px 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: 110px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 32.Which of these is the border? (a) the line round the box (b) the gap to other boxes (c) the text or picture (d) the gap round content
-
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 34.True or false: margin is the gap to other boxes. (a) True (b) False
- 35.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) border (d) padding
- 36.True or false: margin is the gap round content. (a) True (b) False
-
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} -
38.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 39.True or false: padding is space inside the border. (a) False (b) True
- 40.True or false: padding is the gap round content. (a) False (b) True
Answer key
- 174
- border
- False
- 208
- 134
- margin
- True
- 148
- the gap round content
- the gap to other boxes
- False
- 228
- False
- space outside the border
- space inside the border
- 264
- padding
- padding
- 230
- margin
- 170
- False
- 208
- 322
- 170
- the text or picture
- 226
- 254
- 136
- 260
- 358
- the line round the box
- 110
- True
- border
- False
- 182
- 214
- True
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids