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.True or false: JavaScript rounds box corners. (a) True (b) False
- 2.💪 Which flexbox property sets space between boxes? (a) display: flex (b) flex-direction (c) justify-content (d) gap
-
3.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} -
4.✍️ How many declarations (property: value pairs) are in this rule?
p {
width: 300px;
background-color: yellow;
padding: 8px;
font-size: 20px;
} - 5.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the title tag (d) the br tag
- 6.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-size (d) font-weight
-
7.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} - 9.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) red (c) white (d) magenta
-
10.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: white; }
.note { color: orange; } (a) blue (b) white (c) red (d) orange -
11.✍️ What is the selector in this CSS rule?
.note {
text-align: center;
font-weight: bold;
} (a) text-align (b) bold (c) #top (d) .note - 12.True or false: h1 is a class selector. (a) False (b) True
-
13.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 14.🌈 Which hex code is bright green? (a) #00ffff (b) #0000ff (c) #ff00ff (d) #00ff00
- 15.What does color do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
- 16.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
-
17.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 18.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). -
20.🖌️ Where does the text sit on its line?
h1 {
text-align: center;
color: blue;
background-color: green;
font-size: 24px;
} (a) in the middle (b) on the right (c) on the left -
21.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) No (b) Yes - 22.🌈 Which colour is rgb(0, 0, 0)? (a) blue (b) red (c) cyan (d) black
-
23.✍️ How many declarations (property: value pairs) are in this rule?
body {
background-color: yellow;
} - 24.🌈 Which colour is #ffff00? (a) cyan (b) magenta (c) yellow (d) red
- 25.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
-
26.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
#top { color: purple; }
h2 { color: white; } (a) green (b) purple (c) black (d) white - 27.🌈 Which colour of light is strongest in rgb(4, 58, 215)? (a) red (b) green (c) blue
- 28.🌈 In #004500 the green part is the hex number 45. What is it as a normal number?
-
29.🎯 Which CSS selector matches this element?
<div class="box" id="logo">Hello</div> (a) span (b) .logo (c) .box (d) #box - 30.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) changes the text size (d) puts a picture on a page
- 31.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <css> (d) <img>
-
32.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
h1 { color: black; }
h1 { color: red; } (a) black (b) red (c) blue (d) purple -
33.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
h1 { color: orange; }
#end { color: white; } (a) white (b) green (c) blue (d) orange - 34.🧩 Which language makes a form box? (a) HTML (b) CSS (c) JavaScript
-
35.✍️ What is the selector in this CSS rule?
h1 {
text-align: center;
width: 300px;
font-size: 20px;
font-style: italic;
} (a) h1 (b) text-align (c) 300px (d) p -
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 15px;
border: 3px solid black;
margin: 5px;
} -
37.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 4 boxes, each 60px wide (no margins). -
38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
39.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). -
40.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
.box { color: black; }
.box { color: purple; } (a) purple (b) white (c) yellow (d) black
Answer key
- False
- gap
- 22
- 4
- the viewport meta tag
- font-size
- 12
- 190
- red
- orange
- .note
- False
- No
- #00ff00
- sets the letter colour
- #
- 28
- margin
- 20
- in the middle
- No
- black
- 1
- yellow
- blue
- purple
- blue
- 69
- .box
- changes the text size
- <link>
- red
- white
- HTML
- h1
- 286
- 30
- 10
- 60
- purple
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids