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.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
} -
2.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). -
3.✍️ What value is given to color in this rule?
h1 {
width: 300px;
color: red;
font-style: italic;
} (a) color (b) 20px (c) center (d) red -
4.✍️ What value is given to text-align in this rule?
#top {
text-align: center;
margin: 10px;
font-size: 20px;
} (a) center (b) 10px (c) text-align (d) yellow - 5.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) . (d) :
- 6.💪 Which flexbox property picks row or column? (a) gap (b) align-items (c) flex-direction (d) justify-content
-
7.🎯 Which CSS selector matches this element?
<h1 class="star" id="logo">Hello</h1> (a) .logo (b) #end (c) #star (d) #logo - 8.📦 In the box model, which part is the line round the box? (a) border (b) padding (c) content (d) margin
-
9.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 290px;
justify-content: space-between;
}
Inside are 3 boxes, each 50px wide (no margins). -
10.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
.big { color: white; }
.big { color: orange; } (a) orange (b) green (c) purple (d) white - 11.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
- 12.What does text-align do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) makes letters bigger
-
13.🎯 Which CSS selector matches this element?
<li class="big" id="top">Hello</li> (a) .top (b) .big (c) #intro (d) .red -
14.✍️ What is the selector in this CSS rule?
h2 {
text-align: center;
font-style: italic;
border: 2px solid;
} (a) italic (b) h2 (c) text-align (d) h1 - 15.🔍 Which is the odd one out? (a) rounds box corners (b) shows a pop-up message (c) checks a quiz answer (d) counts down a timer
-
16.🖌️ What colour are the letters?
h1 {
font-size: 40px;
text-align: center;
color: white;
background-color: purple;
} (a) purple (b) blue (c) white - 17.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) center (d) space-between
- 18.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
-
19.🎯 Which CSS selector matches this element?
<span class="red" id="hero">Hello</span> (a) .hero (b) p (c) .red (d) #red - 20.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 21.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
-
22.🖌️ What colour is behind the letters?
h1 {
text-align: center;
color: black;
font-size: 32px;
background-color: green;
} (a) green (b) purple (c) black -
23.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 24.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) space outside the border
-
25.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
#top { color: black; }
h2 { color: red; }
.star { color: green; } (a) orange (b) black (c) red (d) green - 26.🌈 Which colour of light is strongest in rgb(32, 189, 129)? (a) green (b) red (c) blue
- 27.Which of these does HTML do? (a) adds space around boxes (b) makes a form box (c) counts down a timer (d) shows a pop-up message
- 28.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
- 29.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
31.🖌️ What colour are the letters?
h2 {
text-align: right;
background-color: white;
color: blue;
font-size: 16px;
} (a) blue (b) white (c) yellow - 32.True or false: CSS makes a form box. (a) True (b) False
- 33.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
- 34.🎯 Which element does the selector .star style? (a) <span class="menu"> (b) <span class="star"> (c) <span id="star"> (d) <p class="note">
- 35.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) yellow (d) red
-
36.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 37.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
-
38.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-weight: bold;
text-align: center;
} -
39.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} -
40.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins).
Answer key
- 1
- 80
- red
- center
- ;
- flex-direction
- #logo
- border
- 70
- orange
- padding
- centres a heading
- .big
- h2
- rounds box corners
- white
- flex-start
- :
- .red
- an element selector
- CSS
- green
- 24
- space inside the border
- black
- green
- makes a form box
- the viewport meta tag
- an id selector
- 22
- blue
- False
- JavaScript
- <span class="star">
- blue
- 16
- <style>
- 2
- 14
- 60
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids