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 picks row or column? (a) gap (b) display: flex (c) align-items (d) flex-direction
-
2.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
p { color: green; }
p { color: yellow; } (a) green (b) purple (c) black (d) yellow - 3.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="big"> (c) <h2 class="big"> (d) <span id="hero">
- 4.True or false: the border is the text or picture. (a) False (b) True
- 5.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) cyan (c) blue (d) bright green
- 6.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
- 7.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
- 8.True or false: #hero is a class selector. (a) True (b) False
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
10.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). -
11.✍️ Which property is set to 10px in this rule?
.note {
color: red;
margin: 10px;
border: 2px solid;
text-align: center;
} (a) 10px (b) margin (c) font-weight (d) padding - 12.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 13.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
-
14.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). - 15.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) : (d) .
- 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
- 17.🎯 Which element does the selector div style? (a) <p class="note"> (b) <div class="note"> (c) <span> (d) <h1 id="logo">
-
18.🖌️ What colour are the letters?
h1 {
color: green;
font-size: 40px;
background-color: black;
text-align: center;
} (a) purple (b) black (c) green -
19.🎯 Which CSS selector matches this element?
<h2 class="red" id="intro">Hello</h2> (a) #main (b) .intro (c) h2 (d) .box - 20.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
- 21.✍️ In color: blue; which part is the property? (a) color (b) ; (c) blue (d) :
- 22.Which of these is the content? (a) space inside the border (b) the gap round content (c) a solid or dotted edge (d) the text or picture
- 23.🔍 Which is the odd one out? (a) rounds box corners (b) gives the page structure (c) makes a link (d) puts a picture on a page
- 24.🌈 Which colour is #ff0000? (a) black (b) yellow (c) red (d) cyan
-
25.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
26.🖌️ How big is the text, in px?
h2 {
text-align: center;
color: green;
font-size: 40px;
background-color: black;
} - 27.Which of these is the border? (a) space outside the border (b) the gap to other boxes (c) a solid or dotted edge (d) space inside the border
-
28.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} (a) Yes (b) No -
29.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 30px;
}
} (a) Yes (b) No -
30.🖌️ What colour is behind the letters?
h2 {
background-color: white;
text-align: left;
color: green;
font-size: 40px;
} (a) white (b) yellow (c) green - 31.🎯 Which sign starts an id selector? (a) & (b) # (c) . (d) @
- 32.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
-
33.🖌️ What colour is behind the letters?
h2 {
text-align: right;
color: purple;
background-color: blue;
font-size: 24px;
} (a) purple (b) white (c) blue - 34.🌈 Which colour of light is strongest in rgb(18, 188, 66)? (a) red (b) blue (c) green
-
35.🖌️ What colour is behind the letters?
p {
text-align: right;
color: black;
font-size: 32px;
background-color: white;
} (a) black (b) yellow (c) white - 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 6 (c) 4 (d) 2
-
37.⚖️ What colour is the text of this element?
<h1 class="menu" id="top">Hi</h1>
CSS:
h1 { color: black; }
h1 { color: green; } (a) white (b) black (c) blue (d) green -
38.🖌️ How big is the text, in px?
p {
text-align: right;
color: white;
font-size: 16px;
background-color: black;
} -
39.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 40.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes
Answer key
- flex-direction
- yellow
- <h2 class="big">
- False
- blue
- padding
- puts boxes in the middle
- False
- 162
- 60
- margin
- an id selector
- <style>
- 30
- ;
- the later one
- <div class="note">
- green
- h2
- CSS
- color
- the text or picture
- rounds box corners
- red
- No
- 40
- a solid or dotted edge
- No
- Yes
- white
- #
- .css
- blue
- green
- white
- 3
- green
- 16
- No
- fits every screen
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids