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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
-
2.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
#end { color: orange; }
h1 { color: red; }
.note { color: green; } (a) purple (b) orange (c) green (d) red - 3.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
- 4.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
-
5.🎯 Which CSS selector matches this element?
<div class="red" id="end">Hello</div> (a) #hero (b) span (c) #end (d) .box - 6.🌈 Which colour of light is strongest in rgb(44, 218, 87)? (a) green (b) red (c) blue
-
7.🖌️ Where does the text sit on its line?
h2 {
background-color: orange;
font-size: 28px;
text-align: left;
color: green;
} (a) in the middle (b) on the right (c) on the left - 8.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) blue (c) bright green (d) red
- 9.True or false: the content is the text or picture. (a) False (b) True
-
10.✍️ Which property is set to 2px solid in this rule?
#top {
border: 2px solid;
font-weight: bold;
background-color: yellow;
width: 300px;
} (a) 2px solid (b) width (c) font-style (d) border -
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} -
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 13.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 14.🌈 In #009400 the green part is the hex number 94. What is it as a normal number?
- 15.🌈 Which hex code is yellow? (a) #000000 (b) #ffff00 (c) #00ffff (d) #ffffff
- 16.True or false: margin is the gap to other boxes. (a) True (b) False
-
17.✍️ Which property is set to 10px in this rule?
li {
font-size: 20px;
margin: 10px;
border: 2px solid;
} (a) 10px (b) font-weight (c) padding (d) margin -
18.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} - 19.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
-
20.✍️ What is the selector in this CSS rule?
p {
background-color: yellow;
color: red;
} (a) background-color (b) p (c) .note (d) red - 21.🌈 In #00dd00 the green part is the hex number dd. What is it as a normal number?
-
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). - 23.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) black (c) blue (d) red
-
24.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: white; }
h1 { color: green; } (a) white (b) green (c) red (d) black -
25.🖌️ Where does the text sit on its line?
h2 {
color: purple;
background-color: blue;
font-size: 28px;
text-align: center;
} (a) on the left (b) on the right (c) in the middle - 26.🎯 Which sign starts a class selector? (a) . (b) @ (c) # (d) &
- 27.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 28.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) color (d) :
- 29.🌈 Which colour of light is strongest in rgb(29, 41, 196)? (a) green (b) red (c) blue
- 30.Which of these is the border? (a) the gap round content (b) a solid or dotted edge (c) space outside the border (d) space inside the border
- 31.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
- 32.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) has no pictures (d) never changes
- 33.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
- 34.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
-
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 50px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 36.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-end (d) flex-start
- 37.True or false: the border is a solid or dotted edge. (a) False (b) True
- 38.True or false: padding is space outside the border. (a) False (b) True
- 39.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
-
40.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
.note { color: white; }
#hero { color: orange; } (a) orange (b) blue (c) black (d) white
Answer key
- the later one
- orange
- JavaScript
- #
- #end
- green
- on the left
- blue
- True
- border
- 252
- 40
- an element selector
- 148
- #ffff00
- True
- margin
- 16
- ;
- p
- 221
- 20
- cyan
- white
- in the middle
- .
- an id selector
- blue
- blue
- a solid or dotted edge
- 255
- fits every screen
- 1
- margin
- 102
- flex-start
- True
- False
- HTML
- orange
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids