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 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 16px;
}
} -
2.🎯 Which CSS selector matches this element?
<span class="big" id="hero">Hello</span> (a) .red (b) #big (c) #top (d) .big - 3.What does font-weight do? (a) makes the text bold (b) makes letters bigger (c) centres a heading (d) sets the letter colour
- 4.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) color (d) background-color
-
5.🖌️ Where does the text sit on its line?
h1 {
font-size: 20px;
background-color: blue;
text-align: left;
color: yellow;
} (a) on the right (b) in the middle (c) on the left -
6.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 32px;
}
} (a) Yes (b) No -
7.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} - 8.True or false: HTML adds space around boxes. (a) True (b) False
- 9.💪 Which flexbox property lines boxes up across? (a) display: flex (b) flex-direction (c) gap (d) align-items
- 10.What does justify-content: space-between do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
-
11.🖌️ How big is the text, in px?
h1 {
font-size: 24px;
text-align: right;
background-color: black;
color: orange;
} - 12.What does background-color do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) sets the letter colour
- 13.True or false: JavaScript lays out the page. (a) False (b) True
- 14.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
-
15.✍️ What is the selector in this CSS rule?
body {
padding: 8px;
text-align: center;
} (a) center (b) body (c) .box (d) padding -
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 17.🔍 Which is the odd one out? (a) adds space around boxes (b) checks a quiz answer (c) rounds box corners (d) sets colours and fonts
- 18.Which of these does HTML do? (a) makes headings and lists (b) checks a quiz answer (c) counts down a timer (d) rounds box corners
- 19.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
-
20.🎯 Which CSS selector matches this element?
<p class="box" id="end">Hello</p> (a) .star (b) .box (c) .end (d) #box - 21.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
-
22.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). - 23.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
- 24.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
- 25.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 26.True or false: .big is a class selector. (a) True (b) False
-
27.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). -
28.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} - 29.🌈 Which hex code is red? (a) #ff00ff (b) #ff0000 (c) #000000 (d) #00ff00
-
30.🎯 Which CSS selector matches this element?
<li class="red" id="end">Hello</li> (a) .box (b) #red (c) li (d) #hero - 31.True or false: the content is the text or picture. (a) False (b) True
-
32.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} - 33.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) gives the page structure (d) changes the text size
-
34.✍️ What is the selector in this CSS rule?
li {
padding: 8px;
text-align: center;
font-weight: bold;
} (a) center (b) padding (c) li (d) body -
35.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
#main { color: purple; }
p { color: yellow; }
.red { color: black; } (a) black (b) orange (c) yellow (d) purple -
36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 37.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) center (d) space-between
-
38.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 40.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
Answer key
- 12
- .big
- makes the text bold
- font-weight
- on the left
- Yes
- 12
- False
- align-items
- equal gaps, none at ends
- 24
- colours behind the text
- False
- packs boxes at the start
- body
- 122
- checks a quiz answer
- makes headings and lists
- an id selector
- .box
- :
- 10
- .
- HTML
- an element selector
- True
- 50
- 20
- #ff0000
- li
- True
- 20
- changes the text size
- li
- purple
- 228
- flex-end
- Yes
- 208
- a class selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids