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 a solid or dotted edge. (a) True (b) False
-
2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} - 3.True or false: margin is the gap to other boxes. (a) True (b) False
- 4.True or false: padding is the gap to other boxes. (a) False (b) True
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 15px;
border: 4px solid black;
margin: 15px;
} -
8.📦 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: 5px solid black;
margin: 10px;
} - 9.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) margin (d) content
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
11.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 15px;
border: 5px solid black;
margin: 10px;
} -
12.📦 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: 5px solid black;
margin: 20px;
} - 13.Which of these is the content? (a) a solid or dotted edge (b) the gap to other boxes (c) space outside the border (d) the text or picture
- 14.True or false: padding is the line round the box. (a) False (b) True
- 15.True or false: padding is space outside the border. (a) True (b) False
- 16.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) space inside the border (d) the text or picture
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
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: 160px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} - 19.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space inside the border (d) space outside the border
- 20.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) border (d) content
- 21.True or false: the border is the text or picture. (a) False (b) True
- 22.True or false: the content is the text or picture. (a) True (b) False
- 23.True or false: padding is space inside the border. (a) True (b) False
- 24.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) the gap round content (d) space outside the border
- 25.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) padding (d) content
- 26.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
-
27.📦 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: 15px;
border: 5px solid black;
margin: 5px;
} -
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: 290px;
padding: 15px;
border: 4px solid black;
margin: 10px;
} - 29.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 15px;
border: 2px solid black;
margin: 0px;
} -
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: 90px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} - 33.Which of these is the border? (a) the text or picture (b) the line round the box (c) space inside the border (d) the gap round content
- 34.True or false: the content is a solid or dotted edge. (a) True (b) False
- 35.True or false: margin is the gap round content. (a) True (b) False
-
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 25px;
border: 3px solid black;
margin: 10px;
} - 37.📦 In the box model, which part is space inside the border? (a) border (b) content (c) padding (d) margin
- 38.Which of these is margin? (a) the line round the box (b) space inside the border (c) the text or picture (d) space outside the border
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 15px;
border: 2px solid black;
margin: 10px;
} -
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 20px;
border: 4px solid black;
margin: 15px;
}
Answer key
- False
- 328
- True
- False
- 358
- 144
- 298
- 100
- padding
- 332
- 220
- 320
- the text or picture
- False
- False
- space inside the border
- 370
- 172
- a solid or dotted edge
- border
- False
- True
- True
- the gap round content
- margin
- the gap to other boxes
- 120
- 328
- margin
- 244
- 244
- 116
- the line round the box
- False
- False
- 206
- padding
- space outside the border
- 174
- 268
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids