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 tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
- 2.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) border (d) margin
-
3.✍️ Which property is set to red in this rule?
h1 {
text-align: center;
width: 300px;
color: red;
} (a) font-size (b) color (c) text-align (d) red - 4.🌈 Which colour of light is strongest in rgb(0, 98, 245)? (a) red (b) green (c) blue
- 5.🔍 Which is the odd one out? (a) makes a link (b) changes the text size (c) puts a picture on a page (d) gives the page structure
-
6.✍️ What is the selector in this CSS rule?
.note {
background-color: yellow;
margin: 10px;
color: red;
} (a) 10px (b) #top (c) .note (d) background-color -
7.🖌️ How big is the text, in px?
h1 {
background-color: red;
text-align: right;
color: black;
font-size: 36px;
} - 8.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) : (d) color
- 9.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
-
10.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 11.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
- 12.🌈 In #000600 the green part is the hex number 06. What is it as a normal number?
-
13.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
14.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} (a) Yes (b) No - 15.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-size (c) font-family (d) color
- 16.What does justify-content: center do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
-
17.✍️ How many declarations (property: value pairs) are in this rule?
.note {
color: red;
font-size: 20px;
font-style: italic;
} - 18.🌈 In #000400 the green part is the hex number 04. What is it as a normal number?
- 19.🎯 Which element does the selector li style? (a) <div> (b) <span class="big"> (c) <p id="intro"> (d) <li class="big">
- 20.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
-
21.🎯 Which CSS selector matches this element?
<li class="menu" id="intro">Hello</li> (a) .note (b) #main (c) li (d) #menu -
22.🖌️ What colour are the letters?
h2 {
text-align: left;
background-color: red;
font-size: 40px;
color: purple;
} (a) black (b) purple (c) red - 23.🔍 Which is the odd one out? (a) changes the text size (b) counts down a timer (c) adds space around boxes (d) sets colours and fonts
-
24.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-weight: bold;
width: 300px;
text-align: center;
} -
25.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} -
26.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
#hero { color: yellow; }
.note { color: white; }
p { color: green; } (a) green (b) purple (c) yellow (d) white - 27.True or false: CSS gives the page structure. (a) False (b) True
- 28.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) exactly 100px (d) turned off
-
29.🖌️ Where does the text sit on its line?
h1 {
text-align: center;
color: blue;
font-size: 28px;
background-color: orange;
} (a) on the left (b) in the middle (c) on the right - 30.🌈 Which colour is #ffffff? (a) white (b) yellow (c) magenta (d) bright green
-
31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 20px;
border: 5px solid black;
margin: 10px;
} -
32.🖌️ What colour are the letters?
p {
font-size: 12px;
text-align: left;
background-color: white;
color: red;
} (a) red (b) orange (c) white - 33.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
34.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
.star { color: yellow; }
#hero { color: red; } (a) blue (b) red (c) yellow (d) black -
35.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 230px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). - 36.🎯 Which element does the selector .big style? (a) <span class="box"> (b) <div id="big"> (c) <div class="red"> (d) <div class="big">
- 37.What does text-align do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) makes letters bigger
-
38.✍️ Which property is set to center in this rule?
.note {
font-weight: bold;
text-align: center;
background-color: yellow;
font-size: 20px;
} (a) center (b) background-color (c) text-align (d) margin - 39.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
- 40.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
Answer key
- <style>
- border
- color
- blue
- changes the text size
- .note
- 36
- color
- equal gaps, none at ends
- Yes
- HTML
- 6
- Yes
- No
- font-size
- puts boxes in the middle
- 3
- 4
- <li class="big">
- ;
- li
- purple
- counts down a timer
- 3
- 252
- yellow
- False
- 800px or wider
- in the middle
- white
- 330
- red
- an id selector
- red
- 30
- <div class="big">
- centres a heading
- text-align
- HTML
- content
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids