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 language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
-
2.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 3.🔍 Which is the odd one out? (a) reacts to a button click (b) changes the page live (c) makes a form box (d) counts down a timer
-
4.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 5.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) makes a link (d) changes the page live
- 6.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) cyan (c) blue (d) magenta
-
7.⚖️ What colour is the text of this element?
<h1 class="box" id="main">Hi</h1>
CSS:
h1 { color: orange; }
.box { color: black; } (a) black (b) white (c) orange (d) red - 8.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
- 9.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 30px;
border: 2px solid black;
margin: 15px;
} -
11.✍️ What is the selector in this CSS rule?
.box {
padding: 8px;
font-size: 20px;
font-style: italic;
background-color: yellow;
} (a) padding (b) 20px (c) h2 (d) .box -
12.✍️ Which property is set to italic in this rule?
p {
font-size: 20px;
background-color: yellow;
margin: 10px;
font-style: italic;
} (a) italic (b) font-size (c) font-style (d) color -
13.✍️ What is the selector in this CSS rule?
h1 {
width: 300px;
color: red;
font-weight: bold;
} (a) p (b) red (c) h1 (d) width - 14.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
- 15.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
-
16.✍️ How many declarations (property: value pairs) are in this rule?
body {
margin: 10px;
} -
17.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
#end { color: yellow; }
h2 { color: red; }
.note { color: orange; } (a) orange (b) purple (c) yellow (d) red - 18.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
- 19.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
-
20.✍️ What is the selector in this CSS rule?
h2 {
margin: 10px;
background-color: yellow;
color: red;
} (a) yellow (b) margin (c) h1 (d) h2 - 21.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
-
22.✍️ What is the selector in this CSS rule?
.box {
font-weight: bold;
margin: 10px;
font-size: 20px;
width: 300px;
} (a) h2 (b) font-weight (c) 10px (d) .box -
23.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). - 24.Which of these does HTML do? (a) changes the page live (b) sets colours and fonts (c) checks a quiz answer (d) gives the page structure
-
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). -
26.✍️ What value is given to color in this rule?
body {
margin: 10px;
color: red;
text-align: center;
width: 300px;
} (a) center (b) color (c) red (d) 20px - 27.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
- 28.🌈 Which colour is #ffffff? (a) white (b) black (c) magenta (d) yellow
- 29.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) fits every screen (d) never changes
-
30.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
h2 { color: blue; }
#main { color: black; }
.star { color: purple; } (a) green (b) purple (c) black (d) blue -
31.✍️ What is the selector in this CSS rule?
.note {
text-align: center;
margin: 10px;
background-color: yellow;
} (a) #top (b) text-align (c) 10px (d) .note -
32.✍️ What is the selector in this CSS rule?
.box {
background-color: yellow;
width: 300px;
} (a) .box (b) h2 (c) background-color (d) 300px - 33.Which of these does CSS do? (a) reacts to a button click (b) makes headings and lists (c) makes a link (d) changes the text size
-
34.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 340px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins). - 35.Which of these does HTML do? (a) reacts to a button click (b) lays out the page (c) puts a picture on a page (d) changes the text size
-
36.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
.red { color: blue; }
p { color: yellow; } (a) yellow (b) blue (c) orange (d) red -
37.🖌️ What colour is behind the letters?
li {
text-align: right;
color: green;
background-color: black;
font-size: 28px;
} (a) blue (b) black (c) green -
38.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 210px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). -
39.🖌️ What colour are the letters?
p {
background-color: blue;
text-align: right;
font-size: 32px;
color: yellow;
} (a) blue (b) red (c) yellow - 40.True or false: .menu is an id selector. (a) False (b) True
Answer key
- CSS
- 28
- makes a form box
- No
- changes the page live
- yellow
- black
- :
- packs boxes at the end
- 144
- .box
- font-style
- h1
- JavaScript
- a class selector
- 1
- yellow
- Cascading Style Sheets
- an element selector
- h2
- the later one
- .box
- 80
- gives the page structure
- 50
- red
- /*
- white
- fits every screen
- black
- .note
- .box
- changes the text size
- 20
- puts a picture on a page
- blue
- black
- 10
- yellow
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids