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 is the odd one out? (a) changes the text size (b) makes a form box (c) gives the page structure (d) makes headings and lists
- 2.✍️ In color: blue; which part is the value? (a) ; (b) color (c) : (d) blue
- 3.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
-
4.✍️ How many declarations (property: value pairs) are in this rule?
.box {
background-color: yellow;
color: red;
margin: 10px;
font-weight: bold;
} -
5.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} -
6.✍️ How many declarations (property: value pairs) are in this rule?
.note {
text-align: center;
font-weight: bold;
color: red;
} -
7.🎯 Which CSS selector matches this element?
<li class="menu" id="intro">Hello</li> (a) div (b) #menu (c) li (d) .note - 8.🎯 Which sign starts a class selector? (a) # (b) . (c) & (d) @
- 9.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
- 10.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Computer Style Sheets
-
11.✍️ What value is given to font-size in this rule?
body {
font-size: 20px;
margin: 10px;
background-color: yellow;
border: 2px solid;
} (a) yellow (b) center (c) 20px (d) font-size - 12.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) 800px or narrower (d) turned off
- 13.🌈 Which colour is #ffffff? (a) blue (b) yellow (c) white (d) magenta
- 14.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
-
15.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). -
16.⚖️ What colour is the text of this element?
<h2 class="box" id="intro">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: blue; } (a) red (b) orange (c) green (d) blue -
17.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
p { color: orange; }
p { color: green; } (a) orange (b) red (c) green (d) purple -
18.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
#logo { color: red; }
.menu { color: blue; } (a) white (b) blue (c) green (d) red - 19.True or false: #top is an id selector. (a) True (b) False
- 20.🌈 Which colour is rgb(255, 255, 255)? (a) cyan (b) white (c) black (d) magenta
- 21.True or false: the content is the gap round content. (a) True (b) False
- 22.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) padding (d) border
-
23.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 24.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
-
25.🖌️ What colour is behind the letters?
p {
text-align: right;
color: purple;
background-color: white;
font-size: 28px;
} (a) red (b) white (c) purple -
26.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: blue; } (a) red (b) orange (c) blue (d) black - 27.What does text-align do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) centres a heading
- 28.🔍 Which is the odd one out? (a) gives the page structure (b) makes headings and lists (c) makes a link (d) changes the page live
-
29.⚖️ What colour is the text of this element?
<h1 class="box" id="main">Hi</h1>
CSS:
h1 { color: orange; }
#main { color: black; } (a) black (b) green (c) orange (d) blue - 30.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the text or picture (d) space inside the border
-
31.✍️ How many declarations (property: value pairs) are in this rule?
.note {
text-align: center;
} - 32.Which of these is margin? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) space outside the border
- 33.🎯 Which element does the selector .big style? (a) <h2 id="big"> (b) <h2 class="red"> (c) <li class="box"> (d) <h2 class="big">
- 34.True or false: margin is the gap to other boxes. (a) True (b) False
-
35.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} - 36.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-start (d) flex-end
-
37.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 38.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
- 39.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
- 40.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
Answer key
- changes the text size
- blue
- flex-end
- 4
- 20
- 3
- li
- .
- HTML
- Cascading Style Sheets
- 20px
- 800px or wider
- white
- 600px or narrower
- 20
- blue
- green
- red
- True
- white
- False
- border
- No
- HTML
- white
- blue
- centres a heading
- changes the page live
- black
- space inside the border
- 1
- space outside the border
- <h2 class="big">
- True
- 24
- center
- Yes
- color
- a class selector
- an element selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids