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.📱 What does a media query check? (a) the screen width (b) the time of day (c) the page title (d) the battery level
-
2.✍️ Which property is set to red in this rule?
.note {
width: 300px;
padding: 8px;
color: red;
} (a) font-size (b) red (c) color (d) text-align - 3.🔍 Which is the odd one out? (a) lays out the page (b) makes a link (c) gives the page structure (d) makes a form box
- 4.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) style (d) src
-
5.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 6.🎯 Which element does the selector li style? (a) <div> (b) <span class="menu"> (c) <p id="end"> (d) <li class="menu">
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 8.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .html (d) .png
-
9.✍️ What value is given to border in this rule?
li {
font-style: italic;
padding: 8px;
border: 2px solid;
font-size: 20px;
} (a) italic (b) 300px (c) 2px solid (d) border -
10.🎯 Which CSS selector matches this element?
<span class="note" id="top">Hello</span> (a) .top (b) #note (c) .big (d) .note -
11.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
p { color: red; }
p { color: blue; } (a) white (b) red (c) orange (d) blue -
12.🖌️ What colour are the letters?
li {
background-color: blue;
font-size: 32px;
text-align: right;
color: yellow;
} (a) yellow (b) blue (c) black -
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 20px;
border: 5px solid black;
margin: 5px;
} - 14.True or false: .menu is a class selector. (a) False (b) True
-
15.✍️ What value is given to font-style in this rule?
li {
font-style: italic;
width: 300px;
font-size: 20px;
} (a) red (b) 20px (c) font-style (d) italic -
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). -
17.🎯 Which CSS selector matches this element?
<li class="big" id="end">Hello</li> (a) div (b) #hero (c) .red (d) li -
18.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} -
19.🖌️ What colour are the letters?
h1 {
font-size: 40px;
background-color: orange;
text-align: right;
color: blue;
} (a) orange (b) black (c) blue - 20.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
-
21.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) Yes (b) No - 22.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 23.🎯 Which element does the selector h1 style? (a) <li class="note"> (b) <h2> (c) <div id="intro"> (d) <h1 class="note">
-
24.🎯 Which CSS selector matches this element?
<div class="red" id="logo">Hello</div> (a) #end (b) #logo (c) .logo (d) .box - 25.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 6 (d) 4
-
26.✍️ What is the selector in this CSS rule?
p {
color: red;
font-size: 20px;
} (a) .note (b) 20px (c) p (d) color - 27.🌈 Which colour of light is strongest in rgb(220, 53, 129)? (a) green (b) red (c) blue
-
28.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
#intro { color: purple; }
h2 { color: red; }
.red { color: blue; } (a) purple (b) blue (c) red (d) yellow -
29.✍️ What value is given to width in this rule?
.note {
width: 300px;
margin: 10px;
text-align: center;
} (a) 300px (b) red (c) width (d) italic - 30.🌈 Which colour is rgb(0, 0, 0)? (a) bright green (b) black (c) red (d) yellow
- 31.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
-
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} - 33.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
- 34.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
-
35.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} - 36.🧩 Which language adds space around boxes? (a) HTML (b) CSS (c) JavaScript
-
37.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} -
38.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
#hero { color: white; }
#hero { color: black; } (a) white (b) black (c) green (d) orange -
39.✍️ What is the selector in this CSS rule?
h1 {
padding: 8px;
text-align: center;
color: red;
width: 300px;
} (a) center (b) padding (c) p (d) h1 - 40.Which of these does JavaScript do? (a) lays out the page (b) reacts to a button click (c) puts a picture on a page (d) makes a link
Answer key
- the screen width
- color
- lays out the page
- style
- 24
- <li class="menu">
- 40
- .css
- 2px solid
- .note
- blue
- yellow
- 260
- True
- italic
- 70
- li
- 18
- blue
- #
- Yes
- an element selector
- <h1 class="note">
- #logo
- 3
- p
- red
- purple
- 300px
- black
- ;
- 104
- puts boxes in the middle
- a class selector
- 16
- CSS
- 20
- black
- h1
- reacts to a button click
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids