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.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} - 2.Which of these is margin? (a) space inside the border (b) the text or picture (c) the gap to other boxes (d) a solid or dotted edge
-
3.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
.note { color: orange; }
.note { color: green; } (a) red (b) green (c) orange (d) black -
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} - 5.True or false: CSS sets colours and fonts. (a) False (b) True
- 6.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
-
7.✍️ Which property is set to 300px in this rule?
h1 {
background-color: yellow;
width: 300px;
} (a) color (b) width (c) 300px (d) font-style -
8.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
p { color: blue; }
.star { color: white; } (a) purple (b) blue (c) red (d) white - 9.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
-
10.🖌️ What colour are the letters?
li {
color: purple;
font-size: 32px;
text-align: center;
background-color: yellow;
} (a) purple (b) yellow (c) white -
11.🖌️ What colour is behind the letters?
h1 {
text-align: left;
background-color: green;
font-size: 32px;
color: red;
} (a) white (b) green (c) red - 12.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
-
13.✍️ Which property is set to 20px in this rule?
.box {
font-size: 20px;
text-align: center;
} (a) font-size (b) background-color (c) text-align (d) 20px -
14.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
15.🖌️ How big is the text, in px?
p {
text-align: center;
color: green;
background-color: yellow;
font-size: 20px;
} -
16.⚖️ What colour is the text of this element?
<h1 class="big" id="top">Hi</h1>
CSS:
#top { color: blue; }
.big { color: green; }
h1 { color: white; } (a) blue (b) green (c) white (d) purple - 17.🌈 Which colour is #00ffff? (a) cyan (b) yellow (c) blue (d) red
- 18.🎯 Which element does the selector div style? (a) <div class="big"> (b) <h1 id="logo"> (c) <span> (d) <p class="big">
-
19.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 20.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
- 21.Which of these is padding? (a) the gap to other boxes (b) the line round the box (c) the gap round content (d) space outside the border
- 22.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
-
23.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
p { color: white; }
p { color: orange; } (a) green (b) white (c) purple (d) orange -
24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 10px;
border: 4px solid black;
margin: 5px;
} -
25.🖌️ How big is the text, in px?
li {
text-align: right;
background-color: yellow;
font-size: 20px;
color: orange;
} -
26.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} - 27.🖌️ Which CSS property colours behind the text? (a) font-size (b) font-family (c) background-color (d) color
-
28.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
29.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
.big { color: purple; }
#main { color: yellow; }
p { color: white; } (a) blue (b) white (c) purple (d) yellow -
30.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 31.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) center (d) space-between
- 32.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
- 33.What does text-align do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) picks the font style
-
34.✍️ How many declarations (property: value pairs) are in this rule?
.box {
color: red;
padding: 8px;
} -
35.✍️ Which property is set to red in this rule?
#top {
color: red;
font-weight: bold;
width: 300px;
font-size: 20px;
} (a) font-size (b) color (c) text-align (d) red - 36.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
-
37.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
.menu { color: green; }
p { color: yellow; } (a) yellow (b) orange (c) green (d) red - 38.🌈 In #b90000 the red part is the hex number b9. What is it as a normal number?
- 39.Which of these does CSS do? (a) changes the page live (b) changes the text size (c) shows a pop-up message (d) makes a form box
-
40.✍️ Which property is set to 300px in this rule?
p {
font-size: 20px;
padding: 8px;
width: 300px;
} (a) 300px (b) color (c) font-style (d) width
Answer key
- 24
- the gap to other boxes
- green
- 196
- True
- <style>
- width
- white
- an element selector
- purple
- green
- /*
- font-size
- No
- 20
- blue
- cyan
- <div class="big">
- 24
- .
- the gap round content
- .css
- orange
- 278
- 20
- 18
- background-color
- Yes
- yellow
- 50
- flex-start
- 600px or narrower
- centres a heading
- 2
- color
- a class selector
- green
- 185
- changes the text size
- width
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids