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.True or false: margin is the gap to other boxes. (a) True (b) False
- 2.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
-
3.📦 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: 5px;
border: 5px solid black;
margin: 5px;
} -
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} -
6.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
7.📦 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: 10px;
border: 4px solid black;
margin: 0px;
} - 8.📦 In the box model, which part is the line round the box? (a) border (b) padding (c) content (d) margin
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} - 10.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
- 11.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) padding (d) border
-
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 25px;
border: 5px solid black;
margin: 0px;
} - 13.True or false: padding is space inside the border. (a) True (b) False
- 14.Which of these is the content? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) space outside the border
- 15.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) space outside the border (d) the gap round content
-
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
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: 90px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} -
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: 280px;
padding: 15px;
border: 2px solid black;
margin: 10px;
} - 19.Which of these is margin? (a) the gap to other boxes (b) the text or picture (c) a solid or dotted edge (d) space inside the border
- 20.True or false: the border is the line round the box. (a) True (b) False
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 22.True or false: padding is a solid or dotted edge. (a) False (b) True
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} -
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
25.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} - 26.Which of these is the border? (a) space inside the border (b) the line round the box (c) the gap to other boxes (d) the text or picture
-
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
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: 190px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} - 29.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) border (d) padding
-
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: 110px;
padding: 5px;
border: 4px solid black;
margin: 15px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 33.True or false: the content is the line round the box. (a) True (b) False
-
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
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: 140px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 36.True or false: padding is the gap round content. (a) True (b) False
- 37.True or false: the border is the gap round content. (a) True (b) False
- 38.Which of these is the border? (a) space outside the border (b) a solid or dotted edge (c) space inside the border (d) the gap round content
- 39.True or false: padding is space outside the border. (a) True (b) False
- 40.📦 In the box model, which part is the gap to other boxes? (a) content (b) padding (c) border (d) margin
Answer key
- True
- space inside the border
- 290
- 320
- 136
- 304
- 228
- border
- 240
- content
- margin
- 200
- True
- the text or picture
- space outside the border
- 94
- 108
- 314
- the gap to other boxes
- True
- 232
- False
- 384
- 130
- 160
- the line round the box
- 156
- 220
- padding
- 128
- 200
- 196
- False
- 154
- 164
- True
- False
- a solid or dotted edge
- False
- margin
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids