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 this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 270px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 2.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) background-color (d) color
-
3.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 430px;
justify-content: flex-start;
}
Inside are 4 boxes, each 100px wide (no margins). - 4.True or false: CSS lays out the page. (a) False (b) True
- 5.Which of these does CSS do? (a) puts a picture on a page (b) changes the text size (c) gives the page structure (d) makes a link
-
6.🎯 Which CSS selector matches this element?
<h1 class="big" id="main">Hello</h1> (a) .main (b) h1 (c) .red (d) #logo -
7.✍️ Which property is set to 20px in this rule?
h1 {
font-size: 20px;
text-align: center;
padding: 8px;
} (a) 20px (b) text-align (c) font-size (d) background-color - 8.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
- 9.🌈 Which colour of light is strongest in rgb(38, 152, 71)? (a) green (b) blue (c) red
- 10.🌈 Which colour is #000000? (a) red (b) bright green (c) black (d) magenta
- 11.What does font-size do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
- 12.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) sets colours and fonts (d) changes the text size
-
13.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
#logo { color: white; }
#logo { color: yellow; } (a) yellow (b) blue (c) green (d) white - 14.True or false: .menu is an id selector. (a) True (b) False
-
15.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 16.True or false: margin is space outside the border. (a) True (b) False
- 17.🎯 Which element does the selector .box style? (a) <p class="star"> (b) <p id="box"> (c) <p class="box"> (d) <h1 class="menu">
- 18.🎯 Can many elements share the same class? (a) No (b) Yes
- 19.True or false: the content is the text or picture. (a) True (b) False
-
20.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
h2 { color: blue; }
.menu { color: yellow; } (a) purple (b) black (c) yellow (d) blue - 21.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) yellow (c) blue (d) white
-
22.✍️ What is the selector in this CSS rule?
h1 {
color: red;
border: 2px solid;
font-weight: bold;
} (a) color (b) 2px solid (c) p (d) h1 - 23.🖌️ Which CSS property colours behind the text? (a) font-weight (b) background-color (c) text-align (d) color
-
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). - 25.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the text size (c) counts down a timer (d) changes the page live
- 26.Which of these does CSS do? (a) checks a quiz answer (b) puts a picture on a page (c) gives the page structure (d) adds space around boxes
- 27.🌈 Which hex code is blue? (a) #ffffff (b) #00ffff (c) #0000ff (d) #000000
- 28.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) space outside the border (d) the gap round content
- 29.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
-
30.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) No (b) Yes -
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 140px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). -
32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} -
33.⚖️ What colour is the text of this element?
<h2 class="box" id="main">Hi</h2>
CSS:
h2 { color: yellow; }
.box { color: red; }
#main { color: black; } (a) orange (b) black (c) red (d) yellow - 34.True or false: CSS puts a picture on a page. (a) True (b) False
- 35.🌈 Which colour of light is strongest in rgb(15, 86, 181)? (a) green (b) blue (c) red
-
36.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} (a) Yes (b) No - 37.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
- 38.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
- 39.🔍 Which is the odd one out? (a) makes headings and lists (b) sets colours and fonts (c) changes the text size (d) lays out the page
-
40.🖌️ What colour are the letters?
p {
text-align: right;
color: yellow;
font-size: 20px;
background-color: orange;
} (a) yellow (b) orange (c) white
Answer key
- 322
- font-size
- 30
- True
- changes the text size
- h1
- font-size
- flex-start
- green
- black
- makes letters bigger
- gives the page structure
- yellow
- False
- 10
- True
- <p class="box">
- Yes
- True
- yellow
- white
- h1
- background-color
- 20
- changes the text size
- adds space around boxes
- #0000ff
- space outside the border
- /*
- No
- 40
- 216
- black
- False
- blue
- Yes
- blue
- packs boxes at the end
- makes headings and lists
- yellow
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids