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 many declarations (property: value pairs) are in this rule?
h2 {
font-size: 20px;
background-color: yellow;
text-align: center;
margin: 10px;
} - 2.True or false: JavaScript checks a quiz answer. (a) True (b) False
-
3.✍️ How many declarations (property: value pairs) are in this rule?
.note {
color: red;
} -
4.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} - 5.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
- 6.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) bright green (c) red (d) magenta
- 7.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
- 8.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
-
9.✍️ Which property is set to 2px solid in this rule?
h2 {
background-color: yellow;
font-style: italic;
border: 2px solid;
text-align: center;
} (a) width (b) font-style (c) 2px solid (d) border -
10.🖌️ What colour is behind the letters?
h1 {
background-color: red;
color: black;
text-align: right;
font-size: 32px;
} (a) black (b) red (c) yellow - 11.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-size (c) font-family (d) font-weight
- 12.True or false: margin is space inside the border. (a) True (b) False
- 13.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
-
14.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
15.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-size: 20px;
} -
16.📱 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;
}
} -
17.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} -
18.✍️ What value is given to background-color in this rule?
.note {
text-align: center;
background-color: yellow;
font-size: 20px;
} (a) background-color (b) 8px (c) yellow (d) 10px -
19.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
p { color: white; }
p { color: blue; } (a) white (b) black (c) red (d) blue -
20.✍️ What value is given to font-style in this rule?
.note {
width: 300px;
font-style: italic;
margin: 10px;
font-weight: bold;
} (a) red (b) 20px (c) italic (d) font-style - 21.True or false: .star is an element selector. (a) False (b) True
- 22.True or false: JavaScript puts a picture on a page. (a) False (b) True
- 23.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 25.🖌️ Which CSS property makes the text bold? (a) font-family (b) font-weight (c) text-align (d) background-color
- 26.Which of these does CSS do? (a) changes the page live (b) checks a quiz answer (c) rounds box corners (d) puts a picture on a page
- 27.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) font-family (d) font-size
- 28.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) adds space around boxes (d) makes headings and lists
-
29.🎯 Which CSS selector matches this element?
<div class="star" id="top">Hello</div> (a) #star (b) #intro (c) .top (d) div -
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). - 31.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
- 32.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
-
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). -
34.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
padding: 8px;
font-size: 20px;
} -
35.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
.red { color: orange; }
.red { color: green; } (a) black (b) orange (c) green (d) red -
36.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
.box { color: green; }
p { color: blue; } (a) blue (b) white (c) green (d) red - 37.Which of these does HTML do? (a) shows a pop-up message (b) changes the text size (c) reacts to a button click (d) puts a picture on a page
- 38.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
-
39.⚖️ What colour is the text of this element?
<h2 class="red" id="end">Hi</h2>
CSS:
h2 { color: yellow; }
#end { color: black; } (a) purple (b) orange (c) yellow (d) black - 40.Which of these does HTML do? (a) changes the page live (b) counts down a timer (c) changes the text size (d) makes headings and lists
Answer key
- 4
- True
- 1
- 20
- /*
- bright green
- sets colours and fonts
- makes the text bold
- border
- red
- font-size
- False
- packs boxes at the start
- 60
- 1
- 12
- 20
- yellow
- blue
- italic
- False
- False
- HTML
- 252
- font-weight
- rounds box corners
- background-color
- makes headings and lists
- div
- 60
- .
- the later one
- 80
- 2
- green
- green
- puts a picture on a page
- red
- black
- makes headings and lists
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids