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.🌈 In #060000 the red part is the hex number 06. What is it as a normal number?
- 2.True or false: #hero is an id selector. (a) True (b) False
- 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
- 4.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) the line round the box
-
5.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} (a) Yes (b) No - 6.🧩 Which language reacts to a button click? (a) JavaScript (b) HTML (c) CSS
- 7.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) lays out the page (d) puts a picture on a page
-
8.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 400px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). -
9.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
.star { color: purple; }
.star { color: blue; } (a) purple (b) blue (c) yellow (d) orange - 10.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) border (d) padding
- 11.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 20px;
border: 5px solid black;
margin: 10px;
} -
13.💪 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). - 14.What does background-color do? (a) colours behind the text (b) picks the font style (c) centres a heading (d) makes the text bold
- 15.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) red (c) cyan (d) bright green
-
16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} -
17.🎯 Which CSS selector matches this element?
<div class="menu" id="end">Hello</div> (a) .note (b) #end (c) #menu (d) #hero -
18.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
19.🖌️ What colour is behind the letters?
h1 {
color: orange;
background-color: black;
text-align: left;
font-size: 12px;
} (a) black (b) orange (c) blue -
20.✍️ What is the selector in this CSS rule?
body {
text-align: center;
font-size: 20px;
border: 2px solid;
margin: 10px;
} (a) .box (b) body (c) 20px (d) text-align - 21.🌈 Which colour of light is strongest in rgb(237, 28, 13)? (a) blue (b) red (c) green
- 22.🌈 Which colour of light is strongest in rgb(238, 60, 98)? (a) green (b) blue (c) red
- 23.True or false: margin is the text or picture. (a) False (b) True
- 24.True or false: the border is a solid or dotted edge. (a) True (b) False
- 25.Which of these does CSS do? (a) makes headings and lists (b) gives the page structure (c) puts a picture on a page (d) lays out the page
-
26.🎯 Which CSS selector matches this element?
<span class="box" id="hero">Hello</span> (a) .star (b) #top (c) #box (d) .box - 27.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) puts a picture on a page (d) makes a link
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} - 29.🌈 Which colour is #ff00ff? (a) cyan (b) magenta (c) red (d) blue
-
30.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
#intro { color: blue; }
.note { color: yellow; } (a) yellow (b) red (c) green (d) blue - 31.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) text-align (c) color (d) font-family
- 32.What does color do? (a) picks the font style (b) centres a heading (c) sets the letter colour (d) colours behind the text
- 33.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 15px;
border: 3px solid black;
margin: 15px;
} - 35.What does font-family do? (a) centres a heading (b) sets the letter colour (c) makes the text bold (d) picks the font style
-
36.✍️ Which property is set to 10px in this rule?
.note {
text-align: center;
color: red;
margin: 10px;
font-style: italic;
} (a) padding (b) font-weight (c) margin (d) 10px - 37.Which of these does JavaScript do? (a) gives the page structure (b) makes a link (c) adds space around boxes (d) checks a quiz answer
- 38.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
- 39.Which of these is the border? (a) space inside the border (b) the gap round content (c) the text or picture (d) a solid or dotted edge
- 40.🌈 Which colour is #ffffff? (a) blue (b) magenta (c) white (d) red
Answer key
- 6
- True
- the later one
- the text or picture
- No
- JavaScript
- puts a picture on a page
- 80
- blue
- margin
- an id selector
- 150
- 80
- colours behind the text
- magenta
- 24
- #end
- 10
- black
- body
- red
- red
- False
- True
- lays out the page
- .box
- reacts to a button click
- 230
- magenta
- blue
- color
- sets the letter colour
- an element selector
- 136
- picks the font style
- margin
- checks a quiz answer
- an element selector
- a solid or dotted edge
- white
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids