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 sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
- 2.🌈 Which colour is #ffffff? (a) white (b) yellow (c) black (d) cyan
-
3.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) Yes (b) No - 4.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
-
5.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 6px;
}
} (a) Yes (b) No -
6.✍️ What is the selector in this CSS rule?
h1 {
color: red;
font-style: italic;
} (a) h1 (b) color (c) italic (d) p - 7.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) align-items (d) flex-direction
-
8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} -
10.🖌️ How big is the text, in px?
li {
font-size: 36px;
color: green;
text-align: right;
background-color: yellow;
} -
11.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
12.✍️ What is the selector in this CSS rule?
.box {
border: 2px solid;
color: red;
background-color: yellow;
} (a) red (b) border (c) h2 (d) .box -
13.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 14.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
- 15.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
-
16.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
.red { color: black; }
.red { color: green; } (a) green (b) yellow (c) white (d) black - 17.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 18.🖌️ Which CSS property colours behind the text? (a) font-weight (b) color (c) font-family (d) background-color
- 19.🌈 Which colour is #ff0000? (a) red (b) white (c) blue (d) bright green
- 20.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
-
21.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 100px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). -
22.⚖️ What colour is the text of this element?
<h1 class="big" id="main">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: black; } (a) red (b) yellow (c) black (d) green - 23.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
-
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} -
25.🎯 Which CSS selector matches this element?
<div class="box" id="main">Hello</div> (a) .main (b) .box (c) #box (d) span - 26.True or false: HTML puts a picture on a page. (a) True (b) False
- 27.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
- 28.🌈 Which colour of light is strongest in rgb(123, 124, 179)? (a) blue (b) red (c) green
-
29.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} (a) Yes (b) No -
30.✍️ How many declarations (property: value pairs) are in this rule?
.box {
margin: 10px;
width: 300px;
font-size: 20px;
font-weight: bold;
} - 31.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
-
32.⚖️ What colour is the text of this element?
<h2 class="red" id="main">Hi</h2>
CSS:
#main { color: orange; }
.red { color: green; }
h2 { color: purple; } (a) orange (b) yellow (c) purple (d) green -
33.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 34.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
- 35.True or false: CSS makes headings and lists. (a) True (b) False
- 36.🌈 In #00de00 the green part is the hex number de. What is it as a normal number?
- 37.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
- 38.🌈 Which colour is rgb(0, 0, 0)? (a) cyan (b) yellow (c) black (d) blue
- 39.🌈 Which colour of light is strongest in rgb(203, 106, 8)? (a) blue (b) red (c) green
-
40.✍️ Which property is set to bold in this rule?
li {
font-style: italic;
font-weight: bold;
} (a) font-weight (b) border (c) width (d) bold
Answer key
- ;
- white
- No
- an id selector
- Yes
- h1
- gap
- 10
- 24
- 36
- 16
- .box
- 80
- equal gaps, none at ends
- HTML
- green
- an element selector
- background-color
- red
- blue
- 20
- black
- flex-direction
- 178
- .box
- True
- /*
- blue
- No
- 4
- Cascading Style Sheets
- orange
- Yes
- puts boxes in the middle
- False
- 222
- 600px or narrower
- black
- red
- font-weight
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids