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.🌈 Which colour of light is strongest in rgb(91, 52, 215)? (a) red (b) blue (c) green
- 2.Which of these does HTML do? (a) adds space around boxes (b) makes a link (c) reacts to a button click (d) sets colours and fonts
- 3.🎯 Can many elements share the same class? (a) Yes (b) No
- 4.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) color (d) background-color
-
5.🖌️ What colour are the letters?
h2 {
background-color: green;
font-size: 36px;
color: black;
text-align: right;
} (a) black (b) green (c) blue -
6.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} -
7.✍️ How many declarations (property: value pairs) are in this rule?
p {
text-align: center;
} - 8.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
- 9.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) shows a pop-up message (d) lays out the page
-
10.⚖️ What colour is the text of this element?
<h2 class="note" id="main">Hi</h2>
CSS:
#main { color: purple; }
h2 { color: green; } (a) purple (b) yellow (c) black (d) green - 11.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) lays out the page (d) checks a quiz answer
-
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 130px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). - 13.🌈 In #0000e4 the blue part is the hex number e4. What is it as a normal number?
- 14.True or false: margin is space outside the border. (a) False (b) True
- 15.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) changes the text size (d) adds space around boxes
- 16.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
-
17.🖌️ How big is the text, in px?
h1 {
color: yellow;
text-align: right;
background-color: orange;
font-size: 20px;
} - 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
-
19.✍️ Which property is set to yellow in this rule?
p {
background-color: yellow;
color: red;
margin: 10px;
} (a) margin (b) background-color (c) padding (d) yellow - 20.🎯 Which element does the selector #top style? (a) <p id="intro"> (b) <p id="top"> (c) <p class="top"> (d) <h1 class="box">
- 21.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) 1 (d) any number
-
22.🎯 Which CSS selector matches this element?
<p class="star" id="end">Hello</p> (a) .end (b) #hero (c) #star (d) #end - 23.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
- 24.True or false: CSS makes headings and lists. (a) False (b) True
- 25.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
- 26.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
- 27.Which of these is padding? (a) the gap to other boxes (b) space inside the border (c) space outside the border (d) the text or picture
-
28.🎯 Which CSS selector matches this element?
<h2 class="star" id="main">Hello</h2> (a) li (b) .main (c) #main (d) #star -
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: 170px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
30.🖌️ What colour is behind the letters?
h2 {
text-align: center;
color: purple;
background-color: yellow;
font-size: 24px;
} (a) yellow (b) blue (c) purple - 31.🌈 In #000079 the blue part is the hex number 79. What is it as a normal number?
-
32.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
#top { color: red; }
#top { color: yellow; } (a) red (b) black (c) yellow (d) green -
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 34.🎯 Which element does the selector #logo style? (a) <p class="logo"> (b) <p id="end"> (c) <p id="logo"> (d) <h1 class="red">
- 35.What does font-family do? (a) centres a heading (b) colours behind the text (c) makes letters bigger (d) picks the font style
- 36.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
- 37.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
- 38.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) black (c) white (d) bright green
- 39.🎯 Which element does the selector .big style? (a) <h1 class="box"> (b) <p id="big"> (c) <p class="big"> (d) <p class="red">
- 40.🎯 Which element does the selector #intro style? (a) <p id="main"> (b) <p class="intro"> (c) <h1 class="big"> (d) <p id="intro">
Answer key
- blue
- makes a link
- Yes
- font-family
- black
- 24
- 1
- JavaScript
- shows a pop-up message
- purple
- lays out the page
- 10
- 228
- True
- puts a picture on a page
- space-between
- 20
- the later one
- background-color
- <p id="top">
- 1
- #end
- color
- False
- #
- <link>
- space inside the border
- #main
- 198
- yellow
- 121
- yellow
- 80
- <p id="logo">
- picks the font style
- ;
- <style>
- bright green
- <p class="big">
- <p id="intro">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids