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 changes the text size? (a) HTML (b) CSS (c) JavaScript
-
2.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
p { color: red; }
p { color: purple; } (a) green (b) red (c) black (d) purple -
3.✍️ Which property is set to red in this rule?
.note {
margin: 10px;
color: red;
} (a) font-size (b) text-align (c) color (d) red -
4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} -
5.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 240px;
justify-content: space-between;
}
Inside are 3 boxes, each 40px wide (no margins). -
6.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
h1 { color: white; }
#top { color: blue; }
.box { color: purple; } (a) purple (b) white (c) black (d) blue -
7.✍️ How many declarations (property: value pairs) are in this rule?
.box {
width: 300px;
margin: 10px;
text-align: center;
padding: 8px;
} - 8.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
9.✍️ What is the selector in this CSS rule?
.box {
width: 300px;
background-color: yellow;
} (a) width (b) h2 (c) .box (d) yellow - 10.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) puts a picture on a page (d) lays out the page
- 11.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) center (d) flex-end
-
12.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-size: 20px;
border: 2px solid;
} - 13.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
-
14.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). -
15.⚖️ What colour is the text of this element?
<p class="big" id="end">Hi</p>
CSS:
p { color: green; }
#end { color: red; }
.big { color: white; } (a) green (b) blue (c) white (d) red - 16.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) border (d) margin
- 17.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <div class="star"> (c) <div class="box"> (d) <span class="menu">
-
18.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 220px;
justify-content: space-between;
}
Inside are 3 boxes, each 40px wide (no margins). -
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} - 20.True or false: CSS makes a form box. (a) True (b) False
-
21.🖌️ What colour are the letters?
li {
text-align: right;
background-color: green;
color: yellow;
font-size: 24px;
} (a) yellow (b) red (c) green -
22.✍️ What value is given to background-color in this rule?
#top {
margin: 10px;
font-style: italic;
background-color: yellow;
text-align: center;
} (a) 8px (b) yellow (c) 10px (d) background-color - 23.True or false: .menu is an id selector. (a) True (b) False
-
24.✍️ Which property is set to 20px in this rule?
.note {
font-size: 20px;
color: red;
padding: 8px;
} (a) text-align (b) background-color (c) 20px (d) font-size - 25.Which of these is margin? (a) a solid or dotted edge (b) space inside the border (c) the text or picture (d) the gap to other boxes
-
26.🖌️ What colour are the letters?
h1 {
background-color: black;
text-align: center;
color: yellow;
font-size: 16px;
} (a) yellow (b) white (c) black - 27.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
-
28.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
#top { color: blue; }
#top { color: white; } (a) green (b) black (c) blue (d) white - 29.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 31.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 32.True or false: the border is the gap to other boxes. (a) True (b) False
- 33.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
-
34.🎯 Which CSS selector matches this element?
<li class="menu" id="logo">Hello</li> (a) .logo (b) #end (c) #menu (d) #logo - 35.True or false: p is an element selector. (a) False (b) True
-
36.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). -
37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 160px;
padding: 10px;
border: 1px solid black;
margin: 15px;
} - 38.What does font-weight do? (a) picks the font style (b) colours behind the text (c) makes letters bigger (d) makes the text bold
- 39.🌈 Which colour of light is strongest in rgb(52, 252, 44)? (a) red (b) green (c) blue
- 40.Which of these does CSS do? (a) makes a link (b) makes a form box (c) lays out the page (d) puts a picture on a page
Answer key
- CSS
- purple
- color
- 246
- 60
- blue
- 4
- an element selector
- .box
- lays out the page
- flex-end
- 2
- center
- 70
- red
- padding
- <div class="box">
- 50
- 170
- False
- yellow
- yellow
- False
- font-size
- the gap to other boxes
- yellow
- the screen width
- white
- HTML
- 204
- an id selector
- False
- 1
- #logo
- True
- 30
- 182
- makes the text bold
- green
- lays out the page
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids