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 of these does JavaScript do? (a) rounds box corners (b) makes a form box (c) lays out the page (d) counts down a timer
-
2.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 160px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). -
3.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
#logo { color: purple; }
.red { color: white; } (a) black (b) purple (c) white (d) orange - 4.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
- 5.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
- 6.🔍 Which is the odd one out? (a) changes the text size (b) sets colours and fonts (c) lays out the page (d) checks a quiz answer
-
7.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 8.Which of these does CSS do? (a) makes headings and lists (b) makes a link (c) lays out the page (d) puts a picture on a page
- 9.🌈 In #c90000 the red part is the hex number c9. What is it as a normal number?
- 10.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) flex-start (d) space-between
- 11.🎯 Which element does the selector li style? (a) <li class="note"> (b) <span class="note"> (c) <p id="top"> (d) <div>
-
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 460px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). - 13.🌈 Which colour is #ff00ff? (a) black (b) cyan (c) magenta (d) white
- 14.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the page live (c) lays out the page (d) rounds box corners
-
15.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 250px;
justify-content: flex-end;
}
Inside are 3 boxes, each 60px wide (no margins). -
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} - 17.✍️ How does a CSS comment start? (a) // (b) # (c) <!-- (d) /*
-
18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 20px;
border: 5px solid black;
margin: 20px;
} -
19.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
20.✍️ What is the selector in this CSS rule?
h2 {
padding: 8px;
margin: 10px;
font-size: 20px;
color: red;
} (a) h2 (b) padding (c) h1 (d) 10px - 21.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
-
22.🖌️ What colour are the letters?
h2 {
background-color: white;
text-align: right;
color: green;
font-size: 40px;
} (a) blue (b) white (c) green -
23.✍️ What value is given to color in this rule?
#top {
margin: 10px;
color: red;
font-weight: bold;
} (a) center (b) color (c) 20px (d) red - 24.True or false: HTML puts a picture on a page. (a) True (b) False
- 25.What does text-align do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) colours behind the text
- 26.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) align-items (d) gap
- 27.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 2 (d) 3
- 28.🌈 Which hex code is black? (a) #ffffff (b) #000000 (c) #ff0000 (d) #00ff00
-
29.✍️ Which property is set to 8px in this rule?
li {
margin: 10px;
padding: 8px;
font-size: 20px;
width: 300px;
} (a) 8px (b) font-weight (c) border (d) padding - 30.💪 Which flexbox property turns on flexbox? (a) align-items (b) flex-direction (c) gap (d) display: flex
- 31.🔍 Which is the odd one out? (a) puts a picture on a page (b) changes the page live (c) shows a pop-up message (d) reacts to a button click
- 32.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) any number (d) 1
- 33.🌈 Which colour is #ffff00? (a) red (b) bright green (c) magenta (d) yellow
- 34.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
- 35.🌈 Which colour is #000000? (a) red (b) blue (c) white (d) black
-
36.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 330px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). -
37.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
p { color: black; }
.box { color: orange; } (a) black (b) blue (c) orange (d) white - 38.Which of these is the content? (a) a solid or dotted edge (b) space outside the border (c) the text or picture (d) space inside the border
- 39.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS
-
40.✍️ What value is given to color in this rule?
body {
background-color: yellow;
color: red;
} (a) color (b) 20px (c) center (d) red
Answer key
- counts down a timer
- 10
- purple
- JavaScript
- fits every screen
- checks a quiz answer
- No
- lays out the page
- 201
- space-between
- <li class="note">
- 70
- magenta
- changes the page live
- 70
- 150
- /*
- 330
- 204
- h2
- :
- green
- red
- True
- centres a heading
- align-items
- 3
- #000000
- padding
- display: flex
- puts a picture on a page
- 1
- yellow
- .
- black
- 30
- orange
- the text or picture
- JavaScript
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids