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 colour is #ffffff? (a) yellow (b) magenta (c) red (d) white
- 2.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
- 3.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
- 4.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) , (d) :
-
5.🖌️ Where does the text sit on its line?
h1 {
text-align: center;
background-color: orange;
font-size: 40px;
color: blue;
} (a) on the left (b) on the right (c) in the middle - 6.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) - (d) =
-
7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} - 8.🎯 Which element does the selector .big style? (a) <h2 id="big"> (b) <li class="box"> (c) <h2 class="red"> (d) <h2 class="big">
- 9.🎯 What kind of selector is li? (a) an element selector (b) an id selector (c) a class selector
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} -
11.🎯 Which CSS selector matches this element?
<span class="big" id="main">Hello</span> (a) .red (b) .main (c) span (d) p -
12.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) Yes (b) No -
13.🎯 Which CSS selector matches this element?
<h1 class="note" id="main">Hello</h1> (a) .big (b) #note (c) #logo (d) .note -
14.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} - 16.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) white (c) magenta (d) black
- 17.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
-
18.🎯 Which CSS selector matches this element?
<div class="red" id="top">Hello</div> (a) div (b) .top (c) #red (d) span - 19.True or false: JavaScript changes the text size. (a) True (b) False
- 20.True or false: padding is space inside the border. (a) True (b) False
-
21.🎯 Which CSS selector matches this element?
<div class="box" id="intro">Hello</div> (a) span (b) .box (c) .intro (d) .star - 22.True or false: #top is an id selector. (a) False (b) True
-
23.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: white; } (a) white (b) orange (c) green (d) purple - 24.🎯 Which sign starts an id selector? (a) . (b) # (c) @ (d) &
-
25.🖌️ How big is the text, in px?
li {
font-size: 24px;
text-align: center;
color: green;
background-color: yellow;
} -
26.⚖️ What colour is the text of this element?
<h2 class="red" id="hero">Hi</h2>
CSS:
.red { color: purple; }
#hero { color: yellow; }
h2 { color: blue; } (a) purple (b) orange (c) blue (d) yellow -
27.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 28.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) color (d) background-color
-
29.🖌️ What colour are the letters?
li {
text-align: right;
color: purple;
background-color: red;
font-size: 40px;
} (a) red (b) green (c) purple - 30.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
- 31.💪 Which flexbox property sets space between boxes? (a) gap (b) flex-direction (c) align-items (d) display: flex
-
32.🎯 Which CSS selector matches this element?
<div class="menu" id="top">Hello</div> (a) div (b) .note (c) #menu (d) .top -
33.🖌️ Where does the text sit on its line?
h1 {
background-color: green;
font-size: 32px;
color: yellow;
text-align: left;
} (a) in the middle (b) on the right (c) on the left -
34.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
#logo { color: yellow; }
.star { color: white; }
p { color: purple; } (a) yellow (b) white (c) purple (d) orange -
35.✍️ What is the selector in this CSS rule?
.note {
width: 300px;
margin: 10px;
color: red;
background-color: yellow;
} (a) 10px (b) #top (c) width (d) .note -
36.✍️ What is the selector in this CSS rule?
h2 {
border: 2px solid;
font-weight: bold;
} (a) bold (b) h1 (c) border (d) h2 - 37.True or false: body is an element selector. (a) False (b) True
-
38.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
#end { color: green; }
.star { color: red; } (a) red (b) black (c) orange (d) green -
39.✍️ What value is given to background-color in this rule?
h1 {
background-color: yellow;
font-style: italic;
} (a) 8px (b) 10px (c) yellow (d) background-color - 40.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) checks a quiz answer (d) adds space around boxes
Answer key
- white
- CSS
- .css
- ;
- in the middle
- :
- 22
- <h2 class="big">
- an element selector
- 224
- span
- No
- .note
- Yes
- 14
- magenta
- 800px or wider
- div
- False
- True
- .box
- True
- white
- #
- 24
- yellow
- 10
- background-color
- purple
- the screen width
- gap
- div
- on the left
- yellow
- .note
- h2
- True
- green
- yellow
- adds space around boxes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids