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 flexbox property lines boxes up across? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
- 2.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) the line round the box (d) space inside the border
-
3.✍️ Which property is set to 2px solid in this rule?
.note {
border: 2px solid;
padding: 8px;
} (a) 2px solid (b) width (c) font-style (d) border - 4.What does justify-content: flex-end do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
-
5.🖌️ What colour is behind the letters?
h2 {
text-align: left;
font-size: 20px;
color: red;
background-color: orange;
} (a) green (b) orange (c) red -
6.🎯 Which CSS selector matches this element?
<h1 class="box" id="intro">Hello</h1> (a) .star (b) #intro (c) h2 (d) #main -
7.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: black; } (a) black (b) green (c) purple (d) red - 8.True or false: .star is a class selector. (a) False (b) True
- 9.🌈 Which colour of light is strongest in rgb(97, 255, 41)? (a) blue (b) red (c) green
-
10.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
#logo { color: green; }
#logo { color: white; } (a) purple (b) white (c) red (d) green -
11.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
#intro { color: yellow; }
.big { color: white; }
p { color: black; } (a) yellow (b) blue (c) black (d) white - 12.✍️ In color: blue; which part is the value? (a) color (b) blue (c) ; (d) :
-
13.⚖️ What colour is the text of this element?
<h1 class="star" id="top">Hi</h1>
CSS:
.star { color: green; }
.star { color: blue; } (a) red (b) purple (c) green (d) blue -
14.✍️ What is the selector in this CSS rule?
li {
font-style: italic;
margin: 10px;
} (a) li (b) body (c) 10px (d) font-style -
15.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
#intro { color: green; }
#intro { color: black; } (a) green (b) orange (c) purple (d) black - 16.📱 What does a media query check? (a) the page title (b) the screen width (c) the battery level (d) the time of day
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 20px;
border: 4px solid black;
margin: 0px;
} -
18.⚖️ What colour is the text of this element?
<h2 class="menu" id="intro">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: purple; } (a) green (b) purple (c) yellow (d) red - 19.True or false: #logo is a class selector. (a) False (b) True
-
20.✍️ What is the selector in this CSS rule?
.note {
color: red;
font-size: 20px;
} (a) color (b) #top (c) 20px (d) .note - 21.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) center (d) flex-end
-
22.🖌️ What colour are the letters?
p {
background-color: red;
text-align: left;
color: yellow;
font-size: 12px;
} (a) orange (b) yellow (c) red -
23.🖌️ What colour is behind the letters?
h2 {
background-color: green;
color: blue;
font-size: 24px;
text-align: left;
} (a) purple (b) green (c) blue -
24.✍️ How many declarations (property: value pairs) are in this rule?
p {
padding: 8px;
border: 2px solid;
} -
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 25px;
border: 5px solid black;
margin: 15px;
} - 26.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) red (c) black (d) bright green
- 27.🌈 In #2a0000 the red part is the hex number 2a. What is it as a normal number?
- 28.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
-
29.✍️ What value is given to color in this rule?
.note {
color: red;
font-size: 20px;
} (a) color (b) center (c) 20px (d) red - 30.Which of these does JavaScript do? (a) rounds box corners (b) shows a pop-up message (c) adds space around boxes (d) makes a form box
- 31.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
- 32.🎯 Which element does the selector #top style? (a) <span class="big"> (b) <div class="top"> (c) <div id="top"> (d) <div id="intro">
-
33.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} - 34.What does justify-content: center 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
- 35.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
-
36.✍️ What is the selector in this CSS rule?
p {
text-align: center;
color: red;
} (a) red (b) .note (c) text-align (d) p -
37.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
38.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
h2 { color: green; }
#intro { color: blue; }
.red { color: white; } (a) green (b) blue (c) yellow (d) white -
39.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} (a) No (b) Yes -
40.⚖️ What colour is the text of this element?
<h1 class="note" id="main">Hi</h1>
CSS:
h1 { color: red; }
.note { color: orange; } (a) red (b) orange (c) blue (d) black
Answer key
- align-items
- the line round the box
- border
- packs boxes at the end
- orange
- #intro
- black
- True
- green
- white
- yellow
- blue
- blue
- li
- black
- the screen width
- 158
- purple
- False
- .note
- flex-end
- yellow
- green
- 2
- 250
- red
- 42
- equal gaps, none at ends
- red
- shows a pop-up message
- CSS
- <div id="top">
- 14
- puts boxes in the middle
- JavaScript
- p
- 10
- blue
- No
- orange
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids