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.🌈 In #00bf00 the green part is the hex number bf. What is it as a normal number?
- 2.🌈 Which colour of light is strongest in rgb(11, 0, 180)? (a) red (b) blue (c) green
- 3.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the line round the box (d) space inside the border
-
4.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} - 5.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
- 6.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
-
7.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 8.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
- 9.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h1 class="note"> (c) <h1 class="big"> (d) <h2 class="red">
- 10.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
-
11.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} (a) Yes (b) No - 12.🌈 In #00005b the blue part is the hex number 5b. What is it as a normal number?
- 13.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) gap (c) display: flex (d) justify-content
- 14.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) blue (c) yellow (d) magenta
-
15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} - 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.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} - 18.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-family (c) font-weight (d) background-color
- 19.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
- 20.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <body> (d) <script>
- 21.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
- 22.🎯 Which sign starts an id selector? (a) & (b) . (c) # (d) @
- 23.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
- 24.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) content (d) padding
-
25.✍️ Which property is set to center in this rule?
h1 {
width: 300px;
text-align: center;
} (a) background-color (b) margin (c) center (d) text-align -
26.🖌️ How big is the text, in px?
h1 {
text-align: left;
color: yellow;
font-size: 24px;
background-color: green;
} -
27.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} -
29.✍️ What value is given to text-align in this rule?
p {
color: red;
font-weight: bold;
font-style: italic;
text-align: center;
} (a) 10px (b) text-align (c) center (d) yellow -
30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 31.🌈 Which hex code is red? (a) #00ff00 (b) #0000ff (c) #ff0000 (d) #ffff00
- 32.What does font-weight do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
-
33.🖌️ What colour is behind the letters?
h2 {
background-color: yellow;
text-align: right;
color: purple;
font-size: 40px;
} (a) red (b) purple (c) yellow - 34.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
- 35.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) flex-end (d) space-between
- 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
- 37.What does justify-content: space-between do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
- 38.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) blue (d) white
-
39.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
.note { color: white; }
.note { color: blue; } (a) blue (b) black (c) white (d) yellow -
40.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
#intro { color: white; }
#intro { color: black; } (a) blue (b) black (c) white (d) purple
Answer key
- 191
- blue
- space inside the border
- 12
- a class selector
- CSS
- Yes
- fits every screen
- <h1 class="note">
- content
- No
- 91
- justify-content
- yellow
- 20
- the later one
- 220
- font-weight
- space-between
- <style>
- HTML
- #
- flex-end
- margin
- text-align
- 24
- No
- 20
- center
- 10
- #ff0000
- makes the text bold
- yellow
- border
- flex-start
- 3
- equal gaps, none at ends
- blue
- blue
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids