CSS Worksheet: Practice Test
Code tip (Rule, then maths): Find the topic: syntax, selectors, properties, colours, box model, cascade, flexbox or media queries. Decide which rule or property applies to the element. For sizes, write the sum down: both sides for the box model, free space for flexbox.
NameDateTime takenScore ___ / 40
-
1.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} -
2.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 3.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or wider (d) 600px or narrower
- 4.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 5.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) content (d) border
-
6.⚖️ What colour is the text of this element?
<h2 class="red" id="logo">Hi</h2>
CSS:
#logo { color: red; }
#logo { color: orange; } (a) orange (b) black (c) red (d) blue -
7.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). - 8.Which of these does CSS do? (a) makes headings and lists (b) makes a link (c) counts down a timer (d) changes the text size
-
9.🖌️ What colour are the letters?
h2 {
font-size: 20px;
background-color: green;
text-align: left;
color: white;
} (a) purple (b) green (c) white - 10.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) font-size (d) color
-
11.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
h2 { color: yellow; }
#hero { color: green; } (a) white (b) yellow (c) green (d) purple - 12.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
-
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 4 boxes, each 60px wide (no margins). - 14.🖌️ Which CSS property colours behind the text? (a) font-size (b) color (c) font-weight (d) background-color
-
15.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
16.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 270px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). -
17.✍️ Which property is set to center in this rule?
body {
padding: 8px;
text-align: center;
} (a) background-color (b) center (c) margin (d) text-align -
18.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 25px;
border: 3px solid black;
margin: 10px;
} - 19.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
-
20.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} - 21.True or false: CSS adds space around boxes. (a) True (b) False
-
22.🖌️ Where does the text sit on its line?
h2 {
font-size: 40px;
color: yellow;
background-color: green;
text-align: center;
} (a) in the middle (b) on the left (c) on the right -
23.✍️ What value is given to margin in this rule?
body {
border: 2px solid;
margin: 10px;
} (a) bold (b) 8px (c) 10px (d) margin -
24.🖌️ Where does the text sit on its line?
h2 {
text-align: center;
font-size: 28px;
background-color: yellow;
color: green;
} (a) on the left (b) in the middle (c) on the right -
25.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 260px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). - 26.🌈 Which hex code is cyan? (a) #0000ff (b) #00ffff (c) #00ff00 (d) #ffff00
-
27.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} (a) No (b) Yes -
28.🖌️ How big is the text, in px?
li {
color: blue;
background-color: yellow;
text-align: center;
font-size: 40px;
} -
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: 140px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 30.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
- 31.Which of these is margin? (a) the gap round content (b) the gap to other boxes (c) space inside the border (d) the text or picture
- 32.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) puts a picture on a page (d) changes the page live
- 33.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) color (d) :
- 34.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
- 35.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
-
36.📦 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: 10px;
} - 37.🌈 Which hex code is red? (a) #00ff00 (b) #ff0000 (c) #0000ff (d) #ffffff
- 38.🌈 In #000b00 the green part is the hex number 0b. What is it as a normal number?
-
39.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 120px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 40.True or false: CSS counts down a timer. (a) False (b) True
Answer key
- 118
- 60
- 600px or narrower
- an id selector
- padding
- orange
- 50
- changes the text size
- white
- color
- green
- ;
- 10
- background-color
- 10
- 10
- text-align
- 266
- /*
- 12
- True
- in the middle
- 10px
- in the middle
- 60
- #00ffff
- Yes
- 40
- 178
- center
- the gap to other boxes
- puts a picture on a page
- color
- flex-end
- CSS
- 84
- #ff0000
- 11
- 40
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids