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.True or false: p is an element selector. (a) False (b) True
- 2.True or false: CSS gives the page structure. (a) False (b) True
-
3.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
#top { color: green; }
#top { color: red; } (a) black (b) red (c) green (d) purple - 4.🌈 Which colour is #00ff00? (a) cyan (b) black (c) bright green (d) blue
- 5.True or false: #main is a class selector. (a) True (b) False
-
6.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
p { color: red; }
.box { color: orange; }
#end { color: white; } (a) white (b) orange (c) green (d) red - 7.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) black (c) bright green (d) yellow
- 8.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-end (c) center (d) flex-start
- 9.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) changes the text size (d) makes a link
-
10.🎯 Which CSS selector matches this element?
<p class="box" id="top">Hello</p> (a) h1 (b) #box (c) .star (d) .box -
11.🎯 Which CSS selector matches this element?
<h1 class="note" id="end">Hello</h1> (a) h2 (b) .big (c) .end (d) .note -
12.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} -
13.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
14.⚖️ What colour is the text of this element?
<h2 class="menu" id="main">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: green; } (a) red (b) yellow (c) black (d) green -
15.✍️ How many declarations (property: value pairs) are in this rule?
li {
text-align: center;
margin: 10px;
padding: 8px;
} -
16.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} -
17.🎯 Which CSS selector matches this element?
<p class="menu" id="intro">Hello</p> (a) #menu (b) #intro (c) .note (d) .intro -
18.✍️ Which property is set to center in this rule?
body {
color: red;
font-size: 20px;
text-align: center;
} (a) center (b) background-color (c) text-align (d) margin -
19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} -
20.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
.red { color: blue; }
#logo { color: purple; } (a) purple (b) orange (c) blue (d) white -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} - 22.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes headings and lists (c) counts down a timer (d) changes the page live
- 23.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) text-align
- 24.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <a> (d) <css>
-
25.✍️ What is the selector in this CSS rule?
p {
border: 2px solid;
color: red;
padding: 8px;
font-weight: bold;
} (a) border (b) red (c) p (d) .note - 26.🌈 Which colour of light is strongest in rgb(37, 195, 138)? (a) blue (b) green (c) red
- 27.Which of these does JavaScript do? (a) makes a form box (b) changes the text size (c) makes headings and lists (d) checks a quiz answer
- 28.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
- 29.🎯 Which element does the selector #top style? (a) <h1 id="top"> (b) <h2 class="menu"> (c) <h1 class="top"> (d) <h1 id="intro">
- 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) the shorter one (d) neither
- 31.🌈 Which colour is #00ffff? (a) bright green (b) cyan (c) yellow (d) white
- 32.True or false: CSS makes headings and lists. (a) True (b) False
-
33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 35.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
- 36.True or false: p is an id selector. (a) True (b) False
- 37.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) red (c) blue (d) white
- 38.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
-
39.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 40.🎯 Which element does the selector .note style? (a) <span class="red"> (b) <div class="note"> (c) <div class="big"> (d) <div id="note">
Answer key
- True
- False
- red
- bright green
- False
- white
- bright green
- center
- changes the text size
- .box
- .note
- 20
- Yes
- green
- 3
- 22
- #intro
- text-align
- 24
- purple
- 250
- makes headings and lists
- background-color
- <link>
- p
- green
- checks a quiz answer
- ;
- <h1 id="top">
- the later one
- cyan
- False
- 10
- 50
- HTML
- False
- white
- fits every screen
- Yes
- <div class="note">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids