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 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 2.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
- 3.Which of these is padding? (a) space inside the border (b) the line round the box (c) a solid or dotted edge (d) the gap to other boxes
-
4.✍️ Which property is set to yellow in this rule?
li {
font-size: 20px;
background-color: yellow;
text-align: center;
padding: 8px;
} (a) yellow (b) background-color (c) margin (d) padding -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} -
6.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
7.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} -
8.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
.star { color: red; }
.star { color: orange; } (a) yellow (b) blue (c) orange (d) red - 9.🔍 Which is the odd one out? (a) reacts to a button click (b) changes the page live (c) gives the page structure (d) shows a pop-up message
- 10.🧩 Which language makes a form box? (a) HTML (b) JavaScript (c) CSS
- 11.🖌️ Which CSS property colours behind the text? (a) font-size (b) background-color (c) color (d) font-weight
- 12.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) align-items (c) display: flex (d) gap
-
13.🖌️ Where does the text sit on its line?
li {
font-size: 36px;
color: blue;
background-color: black;
text-align: center;
} (a) on the left (b) in the middle (c) on the right - 14.🔍 Which is the odd one out? (a) makes a link (b) lays out the page (c) makes headings and lists (d) makes a form box
- 15.True or false: .note is a class selector. (a) True (b) False
- 16.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 3 (d) 4
-
17.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} - 18.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
-
19.✍️ Which property is set to yellow in this rule?
li {
width: 300px;
text-align: center;
background-color: yellow;
font-size: 20px;
} (a) background-color (b) margin (c) padding (d) yellow -
20.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
21.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
#end { color: red; }
p { color: purple; } (a) orange (b) red (c) purple (d) yellow - 22.Which of these does JavaScript do? (a) rounds box corners (b) makes a form box (c) adds space around boxes (d) shows a pop-up message
- 23.🌈 Which colour of light is strongest in rgb(106, 70, 218)? (a) green (b) red (c) blue
-
24.✍️ Which property is set to 2px solid in this rule?
#top {
text-align: center;
width: 300px;
padding: 8px;
border: 2px solid;
} (a) width (b) 2px solid (c) font-style (d) border -
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). - 26.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
- 27.🌈 Which colour of light is strongest in rgb(126, 243, 35)? (a) blue (b) red (c) green
- 28.Which of these is margin? (a) the gap to other boxes (b) the line round the box (c) a solid or dotted edge (d) space inside the border
- 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
-
30.✍️ How many declarations (property: value pairs) are in this rule?
p {
width: 300px;
font-weight: bold;
font-size: 20px;
} -
31.⚖️ What colour is the text of this element?
<h1 class="big" id="end">Hi</h1>
CSS:
#end { color: black; }
#end { color: red; } (a) blue (b) black (c) yellow (d) red -
32.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: red; }
#logo { color: green; }
h1 { color: black; } (a) blue (b) green (c) red (d) black -
33.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} - 34.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) magenta (c) white (d) red
-
35.🖌️ Where does the text sit on its line?
h2 {
background-color: green;
font-size: 24px;
text-align: right;
color: orange;
} (a) on the right (b) on the left (c) in the middle - 36.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) blue (d) red
- 37.✍️ How does a CSS comment start? (a) // (b) /* (c) <!-- (d) #
-
38.⚖️ What colour is the text of this element?
<h2 class="menu" id="end">Hi</h2>
CSS:
#end { color: green; }
#end { color: blue; } (a) green (b) black (c) blue (d) red - 39.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <css> (d) <img>
- 40.💪 Which flexbox property sets space between boxes? (a) align-items (b) flex-direction (c) display: flex (d) gap
Answer key
- Yes
- Cascading Style Sheets
- space inside the border
- background-color
- 216
- No
- 12
- orange
- gives the page structure
- HTML
- background-color
- justify-content
- in the middle
- lays out the page
- True
- 3
- 12
- HTML
- background-color
- 22
- red
- shows a pop-up message
- blue
- border
- 60
- 600px or narrower
- green
- the gap to other boxes
- the later one
- 3
- red
- green
- 330
- yellow
- on the right
- blue
- /*
- blue
- <link>
- gap
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids