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 element does the selector h2 style? (a) <li> (b) <div class="big"> (c) <span id="intro"> (d) <h2 class="big">
- 2.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
- 3.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
-
4.✍️ What is the selector in this CSS rule?
p {
margin: 10px;
color: red;
text-align: center;
background-color: yellow;
} (a) red (b) p (c) .note (d) margin -
5.✍️ Which property is set to 2px solid in this rule?
.box {
font-size: 20px;
border: 2px solid;
color: red;
} (a) font-style (b) border (c) 2px solid (d) width - 6.🎯 Which element does the selector #main style? (a) <h1 id="logo"> (b) <h1 class="main"> (c) <h1 id="main"> (d) <h2 class="note">
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 340px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). - 8.🌈 Which colour of light is strongest in rgb(163, 130, 134)? (a) red (b) green (c) blue
-
9.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
h2 { color: orange; }
.note { color: green; } (a) red (b) yellow (c) orange (d) green - 10.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) space-between (c) center (d) flex-end
-
11.🖌️ What colour are the letters?
h2 {
background-color: white;
color: green;
text-align: left;
font-size: 32px;
} (a) white (b) green (c) yellow -
12.⚖️ What colour is the text of this element?
<h2 class="note" id="hero">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: orange; } (a) green (b) yellow (c) orange (d) purple -
13.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
h2 { color: blue; }
h2 { color: purple; } (a) blue (b) green (c) purple (d) yellow -
14.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) No (b) Yes -
15.🖌️ Where does the text sit on its line?
p {
text-align: right;
color: green;
background-color: orange;
font-size: 36px;
} (a) on the right (b) in the middle (c) on the left -
16.🖌️ What colour are the letters?
h1 {
font-size: 12px;
color: blue;
background-color: purple;
text-align: center;
} (a) white (b) purple (c) blue - 17.🌈 Which colour is #ffffff? (a) white (b) magenta (c) red (d) blue
- 18.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: center;
}
Inside are 3 boxes, each 50px wide (no margins). - 20.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
- 21.Which of these does HTML do? (a) sets colours and fonts (b) shows a pop-up message (c) checks a quiz answer (d) makes a link
- 22.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
-
23.🎯 Which CSS selector matches this element?
<h1 class="red" id="intro">Hello</h1> (a) .box (b) #red (c) .red (d) h2 -
24.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
.star { color: green; }
.star { color: red; } (a) yellow (b) blue (c) green (d) red -
25.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
26.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} (a) Yes (b) No -
27.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
#top { color: purple; }
#top { color: yellow; } (a) green (b) yellow (c) black (d) purple -
28.🖌️ How big is the text, in px?
h2 {
text-align: center;
font-size: 28px;
background-color: yellow;
color: blue;
} - 29.Which of these is the border? (a) the gap to other boxes (b) space outside the border (c) the text or picture (d) a solid or dotted edge
- 30.🎯 Which element does the selector .menu style? (a) <h1 class="big"> (b) <p class="menu"> (c) <p class="note"> (d) <p id="menu">
-
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). -
32.✍️ What value is given to padding in this rule?
.note {
padding: 8px;
color: red;
border: 2px solid;
background-color: yellow;
} (a) 8px (b) 2px solid (c) padding (d) bold -
33.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
.star { color: green; }
#logo { color: black; }
p { color: blue; } (a) blue (b) black (c) green (d) yellow -
34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} -
35.✍️ Which property is set to yellow in this rule?
.note {
text-align: center;
margin: 10px;
background-color: yellow;
} (a) yellow (b) padding (c) background-color (d) margin -
36.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} -
37.🎯 Which CSS selector matches this element?
<li class="big" id="main">Hello</li> (a) .big (b) #big (c) .red (d) .main -
38.✍️ How many declarations (property: value pairs) are in this rule?
#top {
background-color: yellow;
text-align: center;
border: 2px solid;
width: 300px;
} - 39.True or false: padding is the gap to other boxes. (a) False (b) True
- 40.🌈 Which hex code is cyan? (a) #ff00ff (b) #00ffff (c) #ff0000 (d) #00ff00
Answer key
- <h2 class="big">
- the screen width
- center
- p
- border
- <h1 id="main">
- 70
- red
- green
- space-between
- green
- orange
- purple
- Yes
- on the right
- blue
- white
- :
- 40
- JavaScript
- makes a link
- { }
- .red
- red
- Yes
- No
- yellow
- 28
- a solid or dotted edge
- <p class="menu">
- 30
- 8px
- black
- 24
- background-color
- 6
- .big
- 4
- False
- #00ffff
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids