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.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
p { color: yellow; }
p { color: blue; } (a) yellow (b) purple (c) red (d) blue - 2.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-size (c) color (d) background-color
- 3.🎯 Which element does the selector span style? (a) <p> (b) <h1 class="menu"> (c) <h2 id="intro"> (d) <span class="menu">
- 4.🎯 Can many elements share the same class? (a) Yes (b) No
-
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 210px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 6.🌈 Which colour of light is strongest in rgb(72, 115, 164)? (a) red (b) blue (c) green
- 7.💪 Which flexbox property lines boxes up across? (a) align-items (b) gap (c) justify-content (d) display: flex
- 8.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) justify-content (c) display: flex (d) gap
- 9.Which of these does HTML do? (a) lays out the page (b) sets colours and fonts (c) shows a pop-up message (d) makes a link
-
10.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
.note { color: purple; }
#hero { color: red; }
p { color: white; } (a) purple (b) white (c) red (d) black - 11.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
-
12.✍️ What is the selector in this CSS rule?
.note {
font-weight: bold;
margin: 10px;
text-align: center;
color: red;
} (a) #top (b) font-weight (c) .note (d) 10px -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 230px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 14.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
- 15.🔍 Which is the odd one out? (a) reacts to a button click (b) lays out the page (c) checks a quiz answer (d) changes the page live
-
16.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
17.🎯 Which CSS selector matches this element?
<h1 class="star" id="top">Hello</h1> (a) h2 (b) #intro (c) #star (d) h1 -
18.✍️ What value is given to color in this rule?
#top {
color: red;
border: 2px solid;
} (a) red (b) 20px (c) center (d) color - 19.🎯 Which element does the selector .menu style? (a) <div id="menu"> (b) <span class="big"> (c) <div class="note"> (d) <div class="menu">
-
20.🎯 Which CSS selector matches this element?
<span class="box" id="top">Hello</span> (a) p (b) span (c) #box (d) #intro -
21.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 320px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). - 22.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) color (d) :
-
23.✍️ Which property is set to 20px in this rule?
body {
font-size: 20px;
text-align: center;
color: red;
background-color: yellow;
} (a) text-align (b) 20px (c) font-size (d) background-color -
24.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
.red { color: white; }
p { color: blue; } (a) blue (b) white (c) red (d) yellow - 25.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
- 26.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
-
27.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 260px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). - 28.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
- 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
- 30.🌈 Which colour is #ffffff? (a) white (b) cyan (c) red (d) magenta
- 31.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) counts down a timer (d) sets colours and fonts
- 32.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) flex-end (d) center
- 33.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: center;
}
Inside are 3 boxes, each 60px wide (no margins). - 35.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) font-size
- 36.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
-
37.🎯 Which CSS selector matches this element?
<h1 class="box" id="hero">Hello</h1> (a) .box (b) h2 (c) .star (d) #box -
38.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} - 39.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) bright green (c) red (d) black
-
40.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 30px;
border: 5px solid black;
margin: 0px;
}
Answer key
- blue
- color
- <span class="menu">
- Yes
- 10
- blue
- align-items
- display: flex
- makes a link
- red
- 600px or narrower
- .note
- 254
- HTML
- lays out the page
- 30
- h1
- red
- <div class="menu">
- span
- 20
- color
- font-size
- white
- puts boxes in the middle
- .
- 60
- space-between
- the later one
- white
- counts down a timer
- flex-start
- fits every screen
- 80
- background-color
- 800px or wider
- .box
- 26
- bright green
- 200
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids