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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} - 2.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
- 3.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) checks a quiz answer (d) rounds box corners
-
4.⚖️ What colour is the text of this element?
<h1 class="red" id="hero">Hi</h1>
CSS:
h1 { color: orange; }
#hero { color: white; }
.red { color: red; } (a) red (b) orange (c) white (d) blue -
5.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
6.✍️ Which property is set to yellow in this rule?
h1 {
text-align: center;
background-color: yellow;
font-size: 20px;
color: red;
} (a) margin (b) background-color (c) padding (d) yellow -
7.✍️ What is the selector in this CSS rule?
.note {
font-style: italic;
font-size: 20px;
} (a) 20px (b) #top (c) .note (d) font-style -
8.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). -
9.🎯 Which CSS selector matches this element?
<li class="big" id="hero">Hello</li> (a) .red (b) #big (c) li (d) div - 10.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 11.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
- 12.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <li class="top"> (c) <li id="top"> (d) <div class="note">
- 13.🔍 Which is the odd one out? (a) checks a quiz answer (b) sets colours and fonts (c) counts down a timer (d) reacts to a button click
-
14.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
15.🖌️ What colour are the letters?
h1 {
font-size: 12px;
color: green;
text-align: right;
background-color: purple;
} (a) black (b) purple (c) green -
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} - 17.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} - 19.🌈 In #260000 the red part is the hex number 26. What is it as a normal number?
- 20.🌈 Which colour of light is strongest in rgb(245, 68, 126)? (a) blue (b) red (c) green
-
21.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
.menu { color: red; }
.menu { color: black; } (a) blue (b) red (c) black (d) purple - 22.True or false: HTML reacts to a button click. (a) False (b) True
-
23.🖌️ What colour are the letters?
p {
font-size: 36px;
background-color: white;
color: yellow;
text-align: center;
} (a) white (b) yellow (c) green -
24.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
#intro { color: orange; }
.star { color: purple; } (a) white (b) purple (c) green (d) orange - 25.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
- 26.🖌️ Which CSS property picks the font style? (a) font-size (b) color (c) font-family (d) font-weight
- 27.True or false: HTML counts down a timer. (a) False (b) True
-
28.✍️ Which property is set to red in this rule?
.note {
text-align: center;
color: red;
} (a) text-align (b) color (c) red (d) font-size - 29.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
- 30.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) red (c) white (d) black
-
31.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 560px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). - 32.Which of these is padding? (a) the gap round content (b) a solid or dotted edge (c) the text or picture (d) the gap to other boxes
- 33.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
-
34.✍️ How many declarations (property: value pairs) are in this rule?
.box {
color: red;
margin: 10px;
} -
35.🎯 Which CSS selector matches this element?
<p class="big" id="intro">Hello</p> (a) #intro (b) .intro (c) #main (d) #big -
36.✍️ Which property is set to italic in this rule?
li {
margin: 10px;
font-style: italic;
} (a) font-size (b) italic (c) font-style (d) color -
37.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} (a) No (b) Yes - 38.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) display: flex (d) align-items
- 39.True or false: h1 is an id selector. (a) True (b) False
- 40.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
Answer key
- 298
- JavaScript
- checks a quiz answer
- white
- Yes
- background-color
- .note
- 60
- li
- an id selector
- HTML
- <li id="top">
- sets colours and fonts
- No
- green
- 246
- Cascading Style Sheets
- 94
- 38
- red
- black
- False
- yellow
- orange
- ;
- font-family
- False
- color
- fits every screen
- cyan
- 80
- the gap round content
- the screen width
- 2
- #intro
- font-style
- No
- align-items
- False
- flex-start
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids