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.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} -
2.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
.note { color: black; }
.note { color: purple; } (a) black (b) blue (c) red (d) purple - 3.True or false: margin is space inside the border. (a) False (b) True
- 4.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) space-between (d) center
- 5.🎯 Which element does the selector #main style? (a) <h2 class="main"> (b) <li class="big"> (c) <h2 id="main"> (d) <h2 id="logo">
-
6.🖌️ What colour are the letters?
li {
text-align: center;
font-size: 16px;
background-color: white;
color: red;
} (a) orange (b) white (c) red -
7.✍️ What value is given to font-size in this rule?
li {
width: 300px;
text-align: center;
font-size: 20px;
} (a) font-size (b) center (c) yellow (d) 20px -
8.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 9.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
- 10.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 1000 (d) 100
- 11.What does font-weight do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) colours behind the text
-
12.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
#end { color: red; }
#end { color: blue; } (a) green (b) red (c) purple (d) blue - 13.🎯 Which element does the selector #logo style? (a) <div class="box"> (b) <li id="end"> (c) <li id="logo"> (d) <li class="logo">
-
14.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
h2 { color: purple; }
h2 { color: white; } (a) red (b) white (c) purple (d) yellow - 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
-
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} - 17.🧩 Which language adds space around boxes? (a) CSS (b) HTML (c) JavaScript
- 18.🎯 Which element does the selector div style? (a) <div class="note"> (b) <h1 id="logo"> (c) <span> (d) <p class="note">
- 19.🌈 Which colour is rgb(255, 0, 0)? (a) cyan (b) white (c) red (d) magenta
- 20.🎯 Which element does the selector #logo style? (a) <p class="logo"> (b) <h1 class="note"> (c) <p id="end"> (d) <p id="logo">
-
21.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
.big { color: white; }
.big { color: black; } (a) white (b) black (c) red (d) yellow -
22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} - 23.🌈 Which hex code is cyan? (a) #00ff00 (b) #ff0000 (c) #ff00ff (d) #00ffff
- 24.🎨 One CSS file can style how many pages? (a) no pages (b) many pages (c) only one image (d) only one word
- 25.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
-
26.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). - 27.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
- 28.🌈 Which hex code is red? (a) #ff0000 (b) #ffff00 (c) #0000ff (d) #00ffff
-
29.🎯 Which CSS selector matches this element?
<div class="box" id="top">Hello</div> (a) #intro (b) div (c) .star (d) .top -
30.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} -
31.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-style: italic;
margin: 10px;
color: red;
font-size: 20px;
} -
32.⚖️ What colour is the text of this element?
<h2 class="note" id="intro">Hi</h2>
CSS:
#intro { color: purple; }
#intro { color: red; } (a) black (b) purple (c) red (d) yellow -
33.⚖️ What colour is the text of this element?
<h1 class="red" id="main">Hi</h1>
CSS:
#main { color: orange; }
.red { color: black; } (a) black (b) red (c) blue (d) orange -
34.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
.red { color: yellow; }
.red { color: white; } (a) yellow (b) white (c) green (d) red - 35.What does text-align do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) colours behind the text
- 36.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) red (d) blue
- 37.🧩 Which language reacts to a button click? (a) CSS (b) HTML (c) JavaScript
- 38.🌈 Which colour is #0000ff? (a) blue (b) cyan (c) red (d) white
- 39.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
- 40.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
Answer key
- 10
- purple
- False
- flex-start
- <h2 id="main">
- red
- 20px
- 12
- { }
- 255
- makes the text bold
- blue
- <li id="logo">
- white
- center
- 158
- CSS
- <div class="note">
- red
- <p id="logo">
- black
- 26
- #00ffff
- many pages
- blue
- 70
- puts boxes in the middle
- #ff0000
- div
- 12
- 4
- red
- orange
- white
- centres a heading
- red
- JavaScript
- blue
- ;
- :
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids