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 colour is rgb(255, 255, 255)? (a) magenta (b) white (c) cyan (d) yellow
- 2.Which of these does CSS do? (a) changes the text size (b) shows a pop-up message (c) changes the page live (d) puts a picture on a page
- 3.🌈 Which colour of light is strongest in rgb(214, 136, 106)? (a) green (b) blue (c) red
- 4.🌈 Which hex code is blue? (a) #ff0000 (b) #00ffff (c) #00ff00 (d) #0000ff
- 5.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
-
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} -
7.✍️ How many declarations (property: value pairs) are in this rule?
.box {
margin: 10px;
color: red;
} -
8.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
.big { color: green; }
#logo { color: red; }
h2 { color: blue; } (a) blue (b) red (c) white (d) green -
9.🖌️ How big is the text, in px?
h1 {
text-align: right;
font-size: 16px;
background-color: purple;
color: yellow;
} -
10.🎯 Which CSS selector matches this element?
<div class="star" id="intro">Hello</div> (a) span (b) .menu (c) div (d) #star -
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 15px;
border: 3px solid black;
margin: 5px;
} -
12.🖌️ Where does the text sit on its line?
h1 {
font-size: 20px;
color: green;
background-color: yellow;
text-align: left;
} (a) on the left (b) on the right (c) in the middle - 13.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) exactly 1000px (d) turned off
-
14.🎯 Which CSS selector matches this element?
<span class="box" id="end">Hello</span> (a) .star (b) #box (c) p (d) .box - 15.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 17.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) align-items (d) justify-content
-
18.✍️ What value is given to padding in this rule?
p {
padding: 8px;
font-style: italic;
color: red;
font-weight: bold;
} (a) padding (b) bold (c) 2px solid (d) 8px - 19.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
20.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
21.🖌️ What colour are the letters?
h2 {
font-size: 16px;
background-color: yellow;
text-align: right;
color: green;
} (a) yellow (b) white (c) green - 22.Which of these does CSS do? (a) sets colours and fonts (b) makes headings and lists (c) makes a form box (d) changes the page live
-
23.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
#hero { color: blue; }
#hero { color: purple; } (a) blue (b) white (c) orange (d) purple -
24.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
#intro { color: white; }
#intro { color: orange; } (a) blue (b) white (c) orange (d) red - 25.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) black (c) bright green (d) cyan
-
26.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
#logo { color: red; }
.star { color: blue; }
p { color: yellow; } (a) red (b) white (c) yellow (d) blue -
27.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} - 28.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
- 29.Which of these does HTML do? (a) shows a pop-up message (b) puts a picture on a page (c) rounds box corners (d) changes the page live
-
30.🖌️ Where does the text sit on its line?
h1 {
font-size: 24px;
color: red;
text-align: center;
background-color: yellow;
} (a) in the middle (b) on the right (c) on the left - 31.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
-
32.🖌️ Where does the text sit on its line?
p {
color: purple;
text-align: left;
font-size: 16px;
background-color: blue;
} (a) on the right (b) in the middle (c) on the left - 33.What does font-weight do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) picks the font style
-
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). -
35.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
36.✍️ How many declarations (property: value pairs) are in this rule?
.note {
border: 2px solid;
background-color: yellow;
color: red;
} - 37.🌈 Which colour is #ffff00? (a) white (b) yellow (c) red (d) magenta
- 38.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) picks the font style
-
39.🖌️ What colour is behind the letters?
h1 {
background-color: black;
text-align: left;
font-size: 16px;
color: white;
} (a) green (b) white (c) black - 40.🎯 Which element does the selector #main style? (a) <p class="main"> (b) <p id="main"> (c) <p id="logo"> (d) <h1 class="big">
Answer key
- white
- changes the text size
- red
- #0000ff
- 255
- 162
- 2
- red
- 16
- div
- 176
- on the left
- 600px or narrower
- .box
- equal gaps, none at ends
- 308
- flex-direction
- 8px
- an element selector
- 50
- green
- sets colours and fonts
- purple
- orange
- black
- red
- 16
- CSS
- puts a picture on a page
- in the middle
- a class selector
- on the left
- makes the text bold
- 70
- 10
- 3
- yellow
- makes letters bigger
- black
- <p id="main">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids