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 big is the text, in px?
p {
text-align: center;
color: orange;
background-color: white;
font-size: 12px;
} - 2.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) border (d) padding
- 3.True or false: CSS counts down a timer. (a) True (b) False
- 4.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) display: flex (c) gap (d) justify-content
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} - 6.🌈 Which colour of light is strongest in rgb(69, 106, 211)? (a) blue (b) green (c) red
- 7.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
-
8.🖌️ How big is the text, in px?
p {
font-size: 32px;
background-color: green;
color: blue;
text-align: center;
} - 9.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
- 10.True or false: .big is an id selector. (a) False (b) True
- 11.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) sets the letter colour
-
12.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} (a) Yes (b) No - 13.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
-
14.✍️ What is the selector in this CSS rule?
body {
margin: 10px;
font-style: italic;
} (a) italic (b) body (c) .box (d) margin - 15.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
- 16.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} - 18.🌈 Which colour of light is strongest in rgb(32, 240, 41)? (a) green (b) blue (c) red
-
19.🎯 Which CSS selector matches this element?
<div class="box" id="top">Hello</div> (a) span (b) #intro (c) #box (d) div -
20.✍️ Which property is set to bold in this rule?
p {
text-align: center;
font-weight: bold;
} (a) width (b) bold (c) font-weight (d) border -
21.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
h1 { color: purple; }
h1 { color: white; } (a) red (b) green (c) purple (d) white -
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} -
23.🎯 Which CSS selector matches this element?
<li class="box" id="main">Hello</li> (a) .main (b) .star (c) li (d) div - 24.Which of these does JavaScript do? (a) reacts to a button click (b) gives the page structure (c) rounds box corners (d) changes the text size
- 25.🌈 In #002200 the green part is the hex number 22. What is it as a normal number?
- 26.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
-
27.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 80px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} - 29.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
- 30.True or false: margin is the gap to other boxes. (a) True (b) False
- 31.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
-
32.💪 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 60px wide (no margins). - 33.🎯 Which element does the selector .box style? (a) <li class="box"> (b) <li class="star"> (c) <li id="box"> (d) <div class="menu">
- 34.🧩 Which language adds space around boxes? (a) HTML (b) CSS (c) JavaScript
-
35.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
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: 250px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} - 37.🌈 Which colour is #ff00ff? (a) white (b) magenta (c) cyan (d) blue
-
38.⚖️ What colour is the text of this element?
<h1 class="box" id="main">Hi</h1>
CSS:
#main { color: orange; }
#main { color: blue; } (a) blue (b) green (c) red (d) orange - 39.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
- 40.Which of these does HTML do? (a) shows a pop-up message (b) makes a link (c) adds space around boxes (d) changes the page live
Answer key
- 12
- margin
- False
- justify-content
- 262
- blue
- F
- 32
- /*
- False
- colours behind the text
- No
- 800px or wider
- body
- JavaScript
- an element selector
- 244
- green
- div
- font-weight
- white
- 214
- li
- reacts to a button click
- 34
- :
- 30
- 112
- an element selector
- True
- border
- 20
- <li class="box">
- CSS
- Yes
- 272
- magenta
- blue
- fits every screen
- makes a link
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids