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 CSS property centres a heading? (a) font-weight (b) background-color (c) color (d) text-align
- 2.🌈 Which colour is #0000ff? (a) blue (b) magenta (c) yellow (d) cyan
- 3.What does color do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) centres a heading
- 4.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
- 5.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
-
6.🎯 Which CSS selector matches this element?
<p class="box" id="end">Hello</p> (a) #box (b) h1 (c) #end (d) #hero -
7.💪 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). -
8.🖌️ How big is the text, in px?
h2 {
color: blue;
text-align: left;
background-color: yellow;
font-size: 32px;
} - 9.🎯 Which element does the selector li style? (a) <div> (b) <p id="main"> (c) <li class="big"> (d) <span class="big">
-
10.⚖️ What colour is the text of this element?
<h2 class="red" id="hero">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: blue; } (a) blue (b) orange (c) black (d) white - 11.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <body> (d) <script>
-
12.✍️ What value is given to border in this rule?
h2 {
text-align: center;
border: 2px solid;
} (a) italic (b) 2px solid (c) 300px (d) border -
13.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
#intro { color: yellow; }
h1 { color: orange; }
.note { color: black; } (a) yellow (b) purple (c) black (d) orange - 14.Which of these does JavaScript do? (a) changes the page live (b) makes headings and lists (c) rounds box corners (d) makes a form box
-
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: 28px;
}
} -
16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} - 17.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) centres a heading (d) picks the font style
- 18.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) margin (d) border
- 19.🖌️ Which CSS property picks the font style? (a) text-align (b) font-weight (c) font-family (d) background-color
-
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). -
21.⚖️ What colour is the text of this element?
<h2 class="note" id="intro">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: purple; } (a) yellow (b) red (c) purple (d) black - 22.Which of these does HTML do? (a) changes the text size (b) makes a form box (c) lays out the page (d) sets colours and fonts
- 23.Which of these does JavaScript do? (a) gives the page structure (b) makes a link (c) counts down a timer (d) puts a picture on a page
- 24.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
- 25.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) black (c) cyan (d) red
- 26.True or false: img is an id selector. (a) True (b) False
-
27.🎯 Which CSS selector matches this element?
<h2 class="note" id="intro">Hello</h2> (a) .big (b) #intro (c) li (d) #note -
28.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). -
29.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} (a) Yes (b) No -
30.🖌️ What colour is behind the letters?
li {
color: red;
background-color: blue;
text-align: right;
font-size: 16px;
} (a) red (b) yellow (c) blue - 31.True or false: the border is a solid or dotted edge. (a) False (b) True
- 32.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
-
33.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
color: red;
} -
34.⚖️ What colour is the text of this element?
<h1 class="star" id="end">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: yellow; } (a) white (b) red (c) purple (d) yellow - 35.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
- 36.🌈 In #5d0000 the red part is the hex number 5d. What is it as a normal number?
-
37.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 38.🌈 Which colour of light is strongest in rgb(74, 229, 102)? (a) red (b) blue (c) green
-
39.🖌️ What colour is behind the letters?
p {
color: red;
text-align: left;
font-size: 32px;
background-color: white;
} (a) red (b) white (c) yellow - 40.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) J (d) Z
Answer key
- text-align
- blue
- sets the letter colour
- many pages
- puts boxes in the middle
- #end
- 60
- 32
- <li class="big">
- blue
- <style>
- 2px solid
- yellow
- changes the page live
- 24
- 20
- makes the text bold
- border
- font-family
- 10
- purple
- makes a form box
- counts down a timer
- packs boxes at the start
- red
- False
- #intro
- 20
- Yes
- blue
- True
- CSS
- 2
- yellow
- a class selector
- 93
- Yes
- green
- white
- F
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids