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 is the selector in this CSS rule?
h1 {
font-weight: bold;
border: 2px solid;
text-align: center;
width: 300px;
} (a) font-weight (b) 2px solid (c) h1 (d) p - 2.True or false: #logo is an element selector. (a) True (b) False
- 3.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
-
4.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: blue; } (a) yellow (b) orange (c) blue (d) purple - 5.Which of these is the content? (a) space outside the border (b) the gap to other boxes (c) a solid or dotted edge (d) the text or picture
- 6.🌈 Which colour is rgb(255, 255, 255)? (a) white (b) black (c) magenta (d) red
- 7.🎯 Which element does the selector .menu style? (a) <div class="menu"> (b) <div id="menu"> (c) <span class="big"> (d) <div class="note">
-
8.🖌️ What colour is behind the letters?
h2 {
text-align: right;
color: orange;
font-size: 36px;
background-color: black;
} (a) orange (b) green (c) black - 9.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) margin (d) border
- 10.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
-
11.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
} - 12.True or false: HTML reacts to a button click. (a) False (b) True
- 13.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 14.🎨 Which attribute adds CSS inside one tag? (a) alt (b) src (c) style (d) href
-
15.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
#hero { color: purple; }
#hero { color: blue; } (a) purple (b) yellow (c) white (d) blue -
16.🎯 Which CSS selector matches this element?
<h1 class="box" id="logo">Hello</h1> (a) #logo (b) #box (c) .star (d) h2 - 17.True or false: .card is a class selector. (a) False (b) True
- 18.🎯 Can many elements share the same class? (a) Yes (b) No
- 19.True or false: the border is the line round the box. (a) True (b) False
- 20.🧩 Which language changes the text size? (a) CSS (b) JavaScript (c) HTML
- 21.🌈 Which hex code is yellow? (a) #ffffff (b) #ff00ff (c) #00ffff (d) #ffff00
- 22.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
- 23.🌈 In #000057 the blue part is the hex number 57. What is it as a normal number?
-
24.⚖️ What colour is the text of this element?
<h1 class="star" id="top">Hi</h1>
CSS:
.star { color: blue; }
#top { color: green; } (a) orange (b) purple (c) blue (d) green - 25.🎯 Which element does the selector .note style? (a) <h2 class="red"> (b) <h1 class="note"> (c) <h1 id="note"> (d) <h1 class="big">
- 26.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
- 27.✍️ Which sign goes between a property and its value? (a) = (b) - (c) ; (d) :
-
28.✍️ What is the selector in this CSS rule?
h1 {
width: 300px;
border: 2px solid;
margin: 10px;
font-style: italic;
} (a) 2px solid (b) width (c) h1 (d) p -
29.✍️ How many declarations (property: value pairs) are in this rule?
#top {
text-align: center;
color: red;
} -
30.💪 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). - 31.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the gap to other boxes (d) space inside the border
- 32.True or false: JavaScript counts down a timer. (a) True (b) False
- 33.📦 In the box model, which part is space outside the border? (a) content (b) border (c) margin (d) padding
- 34.Which of these is padding? (a) a solid or dotted edge (b) the gap to other boxes (c) the text or picture (d) the gap round content
-
35.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). - 36.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
-
37.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
.star { color: orange; }
p { color: white; }
#end { color: red; } (a) black (b) red (c) orange (d) white -
38.🖌️ What colour is behind the letters?
h1 {
font-size: 32px;
color: purple;
background-color: white;
text-align: left;
} (a) green (b) white (c) purple - 39.🎯 What kind of selector is p? (a) a class selector (b) an element selector (c) an id selector
- 40.🌈 Which colour is #000000? (a) white (b) black (c) bright green (d) blue
Answer key
- h1
- False
- JavaScript
- blue
- the text or picture
- white
- <div class="menu">
- black
- border
- a class selector
- 1
- False
- an id selector
- style
- blue
- #logo
- True
- Yes
- True
- CSS
- #ffff00
- 1
- 87
- green
- <h1 class="note">
- red
- :
- h1
- 2
- 10
- space inside the border
- True
- margin
- the gap round content
- 10
- an element selector
- red
- white
- an element selector
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids