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.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 240px;
justify-content: space-between;
}
Inside are 3 boxes, each 60px wide (no margins). -
2.✍️ Which property is set to 8px in this rule?
p {
color: red;
padding: 8px;
margin: 10px;
font-weight: bold;
} (a) border (b) font-weight (c) padding (d) 8px -
3.⚖️ What colour is the text of this element?
<h2 class="big" id="end">Hi</h2>
CSS:
.big { color: white; }
h2 { color: orange; }
#end { color: blue; } (a) blue (b) red (c) white (d) orange -
4.🖌️ Where does the text sit on its line?
h2 {
font-size: 16px;
color: red;
background-color: black;
text-align: left;
} (a) in the middle (b) on the right (c) on the left -
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 6.✍️ How does a CSS comment start? (a) // (b) # (c) <!-- (d) /*
- 7.🎯 What kind of selector is body? (a) an id selector (b) a class selector (c) an element selector
-
8.🎯 Which CSS selector matches this element?
<div class="star" id="hero">Hello</div> (a) div (b) .menu (c) #top (d) span -
9.✍️ What value is given to color in this rule?
h1 {
font-weight: bold;
margin: 10px;
padding: 8px;
color: red;
} (a) color (b) center (c) 20px (d) red -
10.🖌️ What colour are the letters?
p {
text-align: left;
font-size: 36px;
color: blue;
background-color: green;
} (a) green (b) blue (c) purple - 11.Which of these does HTML do? (a) checks a quiz answer (b) sets colours and fonts (c) makes a form box (d) reacts to a button click
- 12.🔍 Which is the odd one out? (a) checks a quiz answer (b) adds space around boxes (c) rounds box corners (d) changes the text size
-
13.🎯 Which CSS selector matches this element?
<span class="box" id="end">Hello</span> (a) #box (b) .end (c) .box (d) .star - 14.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
-
15.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} - 16.Which of these does CSS do? (a) changes the page live (b) puts a picture on a page (c) rounds box corners (d) reacts to a button click
- 17.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 19.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) border (d) padding
-
20.🎯 Which CSS selector matches this element?
<li class="menu" id="hero">Hello</li> (a) .hero (b) div (c) li (d) #top - 21.🎯 Which sign starts a class selector? (a) . (b) @ (c) & (d) #
- 22.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
- 23.🌈 Which colour is #ffffff? (a) yellow (b) red (c) white (d) black
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 30px;
border: 1px solid black;
margin: 20px;
} - 25.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
-
26.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
p { color: blue; }
p { color: yellow; } (a) blue (b) white (c) yellow (d) green -
27.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} - 28.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
-
29.🖌️ What colour is behind the letters?
li {
font-size: 40px;
background-color: yellow;
text-align: right;
color: red;
} (a) white (b) red (c) yellow - 30.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
-
31.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
32.✍️ What is the selector in this CSS rule?
#top {
font-weight: bold;
color: red;
background-color: yellow;
font-size: 20px;
} (a) red (b) li (c) font-weight (d) #top - 33.True or false: .big is an element selector. (a) True (b) False
-
34.✍️ Which property is set to 8px in this rule?
p {
text-align: center;
padding: 8px;
} (a) font-weight (b) 8px (c) border (d) padding - 35.🌈 Which colour of light is strongest in rgb(155, 4, 64)? (a) red (b) blue (c) green
- 36.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
- 37.True or false: HTML shows a pop-up message. (a) True (b) False
-
38.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: yellow; } (a) green (b) black (c) yellow (d) white - 39.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
- 40.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
Answer key
- 30
- padding
- blue
- on the left
- 70
- /*
- an element selector
- div
- red
- blue
- makes a form box
- checks a quiz answer
- .box
- space-between
- 24
- rounds box corners
- an id selector
- 78
- border
- li
- .
- JavaScript
- white
- 312
- color
- yellow
- 14
- ;
- yellow
- an element selector
- No
- #top
- False
- padding
- red
- HTML
- False
- yellow
- <style>
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids