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 HTML do? (a) checks a quiz answer (b) gives the page structure (c) adds space around boxes (d) changes the text size
-
2.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} -
3.✍️ How many declarations (property: value pairs) are in this rule?
body {
padding: 8px;
color: red;
background-color: yellow;
} - 4.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
- 5.💪 Which flexbox property turns on flexbox? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
-
6.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 16px;
}
} (a) Yes (b) No - 7.🎯 Which element does the selector #end style? (a) <li id="end"> (b) <li class="end"> (c) <li id="hero"> (d) <div class="star">
- 8.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
- 9.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
-
10.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
h2 { color: purple; }
.star { color: orange; }
#logo { color: blue; } (a) blue (b) yellow (c) purple (d) orange - 11.🌈 In #ce0000 the red part is the hex number ce. What is it as a normal number?
- 12.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
-
13.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} - 14.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
- 15.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
- 16.True or false: margin is the line round the box. (a) False (b) True
-
17.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
-
19.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: green; } (a) blue (b) orange (c) purple (d) green -
20.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} - 21.🎯 What kind of selector is li? (a) an element selector (b) an id selector (c) a class selector
- 22.💪 Which flexbox property picks row or column? (a) align-items (b) gap (c) display: flex (d) flex-direction
- 23.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) green (d) red
- 24.Which of these does CSS do? (a) makes a link (b) reacts to a button click (c) makes headings and lists (d) lays out the page
- 25.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
-
26.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
} (a) Yes (b) No -
27.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
text-align: center;
font-size: 20px;
padding: 8px;
font-weight: bold;
} - 28.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
- 29.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-size (d) background-color
- 30.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
-
31.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 32.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
-
33.💪 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). -
34.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 35.True or false: HTML gives the page structure. (a) True (b) False
-
36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} - 37.True or false: HTML makes a form box. (a) True (b) False
- 38.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
-
39.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 40.True or false: #logo is an element selector. (a) False (b) True
Answer key
- gives the page structure
- 8
- 3
- the screen width
- display: flex
- No
- <li id="end">
- center
- blue
- blue
- 206
- packs boxes at the start
- 12
- an element selector
- an element selector
- False
- 208
- the later one
- green
- 16
- an element selector
- flex-direction
- red
- lays out the page
- align-items
- Yes
- 4
- flex-start
- font-size
- { }
- Yes
- flex-end
- 70
- 50
- True
- 18
- True
- an id selector
- No
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids