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 is the odd one out? (a) reacts to a button click (b) sets colours and fonts (c) changes the text size (d) adds space around boxes
-
2.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} (a) No (b) Yes -
3.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
#hero { color: yellow; }
.note { color: orange; }
p { color: green; } (a) black (b) green (c) orange (d) yellow - 4.🌈 Which colour is #ff0000? (a) white (b) red (c) cyan (d) blue
-
5.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 6.True or false: JavaScript puts a picture on a page. (a) False (b) True
- 7.🔍 Which is the odd one out? (a) rounds box corners (b) shows a pop-up message (c) reacts to a button click (d) counts down a timer
- 8.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
-
9.🖌️ What colour is behind the letters?
h1 {
font-size: 12px;
background-color: white;
text-align: right;
color: black;
} (a) blue (b) black (c) white - 10.True or false: JavaScript changes the text size. (a) False (b) True
- 11.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
- 12.Which of these does JavaScript do? (a) checks a quiz answer (b) gives the page structure (c) puts a picture on a page (d) makes a link
- 13.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) background-color (d) text-align
-
14.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
.note { color: purple; }
.note { color: black; } (a) black (b) green (c) white (d) purple - 15.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
- 16.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
- 17.💪 Which flexbox property turns on flexbox? (a) display: flex (b) align-items (c) gap (d) justify-content
- 18.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="box"> (c) <h2 class="box"> (d) <span id="end">
-
19.✍️ What value is given to font-style in this rule?
p {
color: red;
width: 300px;
border: 2px solid;
font-style: italic;
} (a) font-style (b) red (c) 20px (d) italic -
20.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
#top { color: black; }
#top { color: white; } (a) orange (b) white (c) black (d) red - 21.Which of these is padding? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) space inside the border
- 22.True or false: padding is the text or picture. (a) False (b) True
- 23.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
-
24.✍️ What value is given to padding in this rule?
#top {
text-align: center;
padding: 8px;
width: 300px;
font-style: italic;
} (a) bold (b) 8px (c) 2px solid (d) padding - 25.True or false: JavaScript checks a quiz answer. (a) False (b) True
- 26.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-size (c) font-family (d) color
- 27.🌈 Which colour is #000000? (a) red (b) bright green (c) black (d) cyan
-
28.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 350px;
justify-content: space-between;
}
Inside are 4 boxes, each 50px wide (no margins). -
29.✍️ What is the selector in this CSS rule?
body {
text-align: center;
font-size: 20px;
} (a) text-align (b) .box (c) body (d) 20px - 30.🌈 Which colour of light is strongest in rgb(29, 89, 163)? (a) red (b) green (c) blue
- 31.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
-
32.✍️ How many declarations (property: value pairs) are in this rule?
li {
background-color: yellow;
} - 33.🌈 Which colour is #ff00ff? (a) blue (b) magenta (c) bright green (d) red
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 35.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
- 36.True or false: CSS checks a quiz answer. (a) False (b) True
-
37.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
h2 { color: white; }
h2 { color: orange; } (a) orange (b) green (c) white (d) blue -
38.✍️ What is the selector in this CSS rule?
h2 {
margin: 10px;
font-size: 20px;
border: 2px solid;
} (a) h2 (b) h1 (c) margin (d) 20px - 39.Which of these does CSS do? (a) makes headings and lists (b) sets colours and fonts (c) changes the page live (d) makes a link
-
40.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
color: red;
font-weight: bold;
}
Answer key
- reacts to a button click
- No
- yellow
- red
- 10
- False
- rounds box corners
- puts boxes in the middle
- white
- False
- /*
- checks a quiz answer
- font-family
- black
- fits every screen
- #
- display: flex
- <h2 class="box">
- italic
- white
- space inside the border
- False
- red
- 8px
- True
- font-size
- black
- 50
- body
- blue
- HTML
- 1
- magenta
- 80
- HTML
- False
- orange
- h2
- sets colours and fonts
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids