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.True or false: li is an element selector. (a) True (b) False
- 2.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 100 (c) 255 (d) 99
- 3.🎯 Which element does the selector .big style? (a) <li class="big"> (b) <li id="big"> (c) <li class="red"> (d) <div class="box">
- 4.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
- 5.True or false: the border is the line round the box. (a) False (b) True
- 6.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-size (d) font-weight
-
7.⚖️ What colour is the text of this element?
<h2 class="box" id="end">Hi</h2>
CSS:
.box { color: orange; }
h2 { color: yellow; } (a) black (b) orange (c) yellow (d) red - 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
- 9.True or false: .big is a class selector. (a) True (b) False
-
10.✍️ How many declarations (property: value pairs) are in this rule?
p {
border: 2px solid;
width: 300px;
padding: 8px;
} - 11.🎯 Which element does the selector .big style? (a) <div id="big"> (b) <div class="big"> (c) <div class="red"> (d) <span class="box">
-
12.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
margin: 10px;
font-style: italic;
text-align: center;
} - 13.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
-
14.🖌️ How big is the text, in px?
h1 {
background-color: orange;
text-align: left;
font-size: 36px;
color: red;
} - 15.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) space inside the border
-
16.🖌️ How big is the text, in px?
h1 {
text-align: center;
font-size: 28px;
background-color: purple;
color: white;
} - 17.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) [ ] (d) ( )
-
18.🖌️ What colour is behind the letters?
li {
text-align: center;
background-color: green;
font-size: 24px;
color: white;
} (a) green (b) white (c) yellow -
19.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} - 20.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
-
21.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
#top { color: black; }
.menu { color: white; } (a) black (b) white (c) orange (d) green -
22.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} -
23.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 120px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). -
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: 170px;
padding: 10px;
border: 5px solid black;
margin: 20px;
} - 25.🔍 Which is the odd one out? (a) counts down a timer (b) puts a picture on a page (c) makes headings and lists (d) makes a link
- 26.💪 Which flexbox property sets space between boxes? (a) align-items (b) display: flex (c) gap (d) flex-direction
- 27.💪 Which flexbox property picks row or column? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
- 28.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
-
29.✍️ Which property is set to 300px in this rule?
h1 {
width: 300px;
color: red;
font-size: 20px;
} (a) 300px (b) color (c) font-style (d) width - 30.What does color do? (a) colours behind the text (b) sets the letter colour (c) centres a heading (d) makes letters bigger
- 31.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) flex-start (d) center
-
32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} - 33.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
-
34.🖌️ What colour are the letters?
h1 {
background-color: red;
text-align: left;
color: orange;
font-size: 12px;
} (a) red (b) purple (c) orange -
35.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
p { color: blue; }
p { color: white; } (a) blue (b) red (c) purple (d) white -
36.⚖️ What colour is the text of this element?
<h1 class="star" id="logo">Hi</h1>
CSS:
#logo { color: blue; }
#logo { color: red; } (a) yellow (b) orange (c) red (d) blue - 37.True or false: .menu is an id selector. (a) True (b) False
-
38.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
.red { color: blue; }
p { color: orange; }
#top { color: yellow; } (a) blue (b) yellow (c) orange (d) red -
39.✍️ What is the selector in this CSS rule?
p {
text-align: center;
padding: 8px;
} (a) text-align (b) 8px (c) .note (d) p - 40.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) align-items (c) gap (d) display: flex
Answer key
- True
- 255
- <li class="big">
- HTML
- True
- color
- orange
- the later one
- True
- 3
- <div class="big">
- 4
- packs boxes at the end
- 36
- space inside the border
- 28
- { }
- green
- 20
- an id selector
- black
- 20
- 40
- 200
- counts down a timer
- gap
- flex-direction
- equal gaps, none at ends
- width
- sets the letter colour
- flex-start
- 8
- an id selector
- orange
- white
- red
- False
- yellow
- p
- display: flex
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids