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 justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) flex-end (d) center
-
2.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
border: 2px solid;
background-color: yellow;
font-size: 20px;
color: red;
} - 3.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
-
4.🎯 Which CSS selector matches this element?
<div class="box" id="intro">Hello</div> (a) .intro (b) .star (c) div (d) #main - 5.What does font-family do? (a) makes the text bold (b) picks the font style (c) sets the letter colour (d) makes letters bigger
-
6.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} -
7.✍️ What value is given to padding in this rule?
.box {
padding: 8px;
font-weight: bold;
} (a) 2px solid (b) padding (c) 8px (d) bold - 8.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
-
9.🖌️ What colour is behind the letters?
h1 {
font-size: 28px;
color: black;
background-color: yellow;
text-align: right;
} (a) yellow (b) black (c) red -
10.⚖️ What colour is the text of this element?
<h2 class="box" id="end">Hi</h2>
CSS:
#end { color: white; }
.box { color: blue; }
h2 { color: red; } (a) green (b) blue (c) white (d) red - 11.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
- 12.What does text-align do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) picks the font style
-
13.🖌️ What colour are the letters?
h1 {
font-size: 16px;
text-align: left;
color: white;
background-color: orange;
} (a) orange (b) yellow (c) white - 14.🌈 Which colour is #ffff00? (a) cyan (b) yellow (c) magenta (d) bright green
- 15.True or false: #main is an id selector. (a) True (b) False
-
16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} -
17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
18.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
#intro { color: yellow; }
#intro { color: blue; } (a) black (b) yellow (c) blue (d) white - 19.🌈 Which hex code is bright green? (a) #00ffff (b) #ffffff (c) #00ff00 (d) #000000
- 20.True or false: HTML makes a form box. (a) True (b) False
-
21.🖌️ What colour are the letters?
li {
text-align: left;
background-color: green;
color: blue;
font-size: 28px;
} (a) white (b) blue (c) green - 22.Which of these does CSS do? (a) makes a link (b) changes the page live (c) rounds box corners (d) makes a form box
- 23.🔍 Which is the odd one out? (a) changes the page live (b) puts a picture on a page (c) makes headings and lists (d) makes a link
- 24.True or false: the content is the text or picture. (a) False (b) True
- 25.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
- 26.🌈 Which hex code is blue? (a) #ffff00 (b) #0000ff (c) #ff00ff (d) #ffffff
- 27.💪 Which flexbox property spaces boxes along a row? (a) gap (b) align-items (c) flex-direction (d) justify-content
- 28.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
- 29.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) red (c) bright green (d) black
- 30.✍️ In color: blue; which part is the property? (a) : (b) color (c) ; (d) blue
-
31.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
p { color: blue; }
#end { color: black; } (a) blue (b) purple (c) white (d) black -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 20px;
border: 5px solid black;
margin: 10px;
} - 33.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
- 34.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) # (d) //
- 35.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) gap
-
36.🖌️ What colour is behind the letters?
li {
text-align: center;
color: green;
font-size: 36px;
background-color: yellow;
} (a) green (b) black (c) yellow - 37.True or false: the content is space inside the border. (a) False (b) True
- 38.🖌️ Which CSS property sets the letter colour? (a) text-align (b) color (c) background-color (d) font-size
- 39.Which of these does CSS do? (a) changes the page live (b) reacts to a button click (c) changes the text size (d) gives the page structure
-
40.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
p { color: green; }
p { color: purple; } (a) white (b) green (c) purple (d) red
Answer key
- center
- 4
- #
- div
- picks the font style
- 20
- 8px
- border
- yellow
- white
- space-between
- centres a heading
- white
- yellow
- True
- 26
- 12
- blue
- #00ff00
- True
- blue
- rounds box corners
- changes the page live
- True
- a class selector
- #0000ff
- justify-content
- 255
- bright green
- color
- black
- 200
- flex-end
- /*
- flex-direction
- yellow
- False
- color
- changes the text size
- purple
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids