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 flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) gap (d) flex-direction
- 2.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
- 3.🎯 What kind of selector is p? (a) a class selector (b) an element selector (c) an id selector
- 4.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
- 5.🎯 Can many elements share the same class? (a) No (b) Yes
- 6.Which of these does JavaScript do? (a) changes the page live (b) makes a form box (c) gives the page structure (d) makes headings and lists
- 7.🖌️ Which CSS property makes the text bold? (a) text-align (b) color (c) font-weight (d) font-family
-
8.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 3 boxes, each 40px wide (no margins). - 9.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) colours behind the text
- 10.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
-
11.🖌️ What colour is behind the letters?
h2 {
background-color: white;
text-align: right;
color: red;
font-size: 40px;
} (a) purple (b) red (c) white -
12.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
#top { color: white; }
.note { color: yellow; } (a) red (b) yellow (c) orange (d) white - 13.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the viewport meta tag (d) the br tag
-
14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 15.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) red (d) green
-
16.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} - 17.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
- 18.Which of these does HTML do? (a) makes a link (b) changes the text size (c) sets colours and fonts (d) lays out the page
-
19.🎯 Which CSS selector matches this element?
<div class="note" id="intro">Hello</div> (a) .big (b) #note (c) .note (d) .intro -
20.✍️ How many declarations (property: value pairs) are in this rule?
body {
width: 300px;
font-weight: bold;
padding: 8px;
border: 2px solid;
} - 21.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) yellow (c) bright green (d) magenta
- 22.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) border (d) padding
- 23.🌈 Which colour is #ffffff? (a) blue (b) white (c) red (d) black
-
24.✍️ Which property is set to bold in this rule?
h1 {
width: 300px;
font-weight: bold;
} (a) border (b) width (c) font-weight (d) bold -
25.🖌️ What colour is behind the letters?
h2 {
background-color: red;
text-align: right;
font-size: 32px;
color: green;
} (a) red (b) black (c) green -
26.✍️ Which property is set to center in this rule?
h2 {
text-align: center;
font-style: italic;
padding: 8px;
} (a) margin (b) center (c) text-align (d) background-color - 27.True or false: #logo is a class selector. (a) False (b) True
-
28.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
30.🖌️ What colour are the letters?
li {
background-color: red;
font-size: 24px;
color: blue;
text-align: right;
} (a) black (b) blue (c) red - 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) J (d) F
- 32.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
-
33.💪 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). -
34.🖌️ Where does the text sit on its line?
h1 {
background-color: orange;
color: yellow;
font-size: 12px;
text-align: center;
} (a) on the right (b) in the middle (c) on the left - 35.📦 In the box model, which part is the gap round content? (a) margin (b) padding (c) content (d) border
- 36.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
-
37.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 38.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} - 40.🌈 Which colour of light is strongest in rgb(105, 193, 26)? (a) green (b) red (c) blue
Answer key
- display: flex
- flex-start
- an element selector
- equal gaps, none at ends
- Yes
- changes the page live
- font-weight
- 30
- makes letters bigger
- CSS
- white
- white
- the viewport meta tag
- 20
- red
- 16
- fits every screen
- makes a link
- .note
- 4
- magenta
- padding
- white
- font-weight
- red
- text-align
- False
- 12
- 112
- blue
- F
- a class selector
- 50
- in the middle
- padding
- a class selector
- 20
- an id selector
- 268
- green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids