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.🖌️ Where does the text sit on its line?
li {
color: orange;
background-color: white;
font-size: 32px;
text-align: center;
} (a) on the right (b) on the left (c) in the middle - 2.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
-
3.✍️ Which property is set to 20px in this rule?
body {
color: red;
font-size: 20px;
background-color: yellow;
text-align: center;
} (a) font-size (b) background-color (c) 20px (d) text-align - 4.🌈 Which colour of light is strongest in rgb(153, 10, 81)? (a) green (b) blue (c) red
-
5.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
6.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 14px;
}
} - 7.🎯 Which sign starts an id selector? (a) @ (b) . (c) # (d) &
- 8.🌈 Which colour is #000000? (a) red (b) bright green (c) yellow (d) black
- 9.True or false: the border is the gap to other boxes. (a) True (b) False
-
10.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
#top { color: red; }
#top { color: blue; } (a) red (b) blue (c) orange (d) green - 11.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
-
12.✍️ Which property is set to bold in this rule?
h2 {
font-weight: bold;
border: 2px solid;
} (a) width (b) bold (c) font-weight (d) border -
13.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 14.🎯 Can many elements share the same class? (a) Yes (b) No
- 15.True or false: CSS rounds box corners. (a) True (b) False
- 16.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) margin (d) border
-
17.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 32px;
}
} - 18.🌈 Which colour is #00ff00? (a) yellow (b) bright green (c) blue (d) black
- 19.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) color (d) :
- 20.True or false: #end is a class selector. (a) True (b) False
-
21.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 90px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). -
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 23.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 100 (d) 1000
- 24.🔍 Which is the odd one out? (a) makes headings and lists (b) reacts to a button click (c) shows a pop-up message (d) counts down a timer
- 25.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
-
26.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
text-align: center;
font-style: italic;
} -
27.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
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: 160px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} -
29.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: orange; }
h1 { color: green; } (a) orange (b) purple (c) green (d) white - 30.What does background-color do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) centres a heading
-
31.✍️ How many declarations (property: value pairs) are in this rule?
.box {
margin: 10px;
text-align: center;
} - 32.🎯 Which element does the selector #intro style? (a) <h1 class="intro"> (b) <h1 id="intro"> (c) <h2 class="big"> (d) <h1 id="main">
-
33.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} -
34.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 32px;
}
} -
35.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
-
37.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). -
38.🎯 Which CSS selector matches this element?
<h2 class="red" id="end">Hello</h2> (a) #hero (b) #end (c) .box (d) .end -
39.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins).
Answer key
- in the middle
- CSS
- font-size
- red
- 20
- 14
- #
- black
- False
- blue
- F
- font-weight
- No
- Yes
- True
- margin
- 24
- bright green
- color
- False
- 10
- 20
- 255
- makes headings and lists
- .
- 3
- Yes
- 198
- orange
- colours behind the text
- 2
- <h1 id="intro">
- 12
- 32
- No
- 800px or wider
- 40
- #end
- No
- 30
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids