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: img is a class selector. (a) True (b) False
- 2.Which of these does HTML do? (a) shows a pop-up message (b) makes a form box (c) lays out the page (d) sets colours and fonts
- 3.🌈 Which hex code is white? (a) #ffff00 (b) #00ffff (c) #ff0000 (d) #ffffff
- 4.True or false: the content is the text or picture. (a) False (b) True
- 5.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
-
6.🖌️ What colour are the letters?
p {
font-size: 20px;
text-align: left;
background-color: blue;
color: black;
} (a) blue (b) black (c) green - 7.True or false: HTML changes the page live. (a) False (b) True
-
8.🖌️ What colour is behind the letters?
li {
font-size: 28px;
background-color: white;
text-align: right;
color: yellow;
} (a) blue (b) white (c) yellow - 9.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
- 10.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
- 11.True or false: h1 is an id selector. (a) True (b) False
- 12.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
-
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 1px solid black;
margin: 5px;
} - 14.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
-
15.✍️ Which property is set to red in this rule?
.box {
font-style: italic;
color: red;
background-color: yellow;
} (a) color (b) text-align (c) font-size (d) red - 16.True or false: body is a class selector. (a) True (b) False
-
17.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} -
18.📦 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: 3px solid black;
margin: 10px;
} -
19.✍️ Which property is set to yellow in this rule?
#top {
background-color: yellow;
width: 300px;
} (a) background-color (b) yellow (c) padding (d) margin - 20.🌈 Which colour is #ffffff? (a) cyan (b) red (c) white (d) yellow
- 21.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap round content (d) the line round the box
-
22.🖌️ How big is the text, in px?
li {
color: purple;
font-size: 24px;
text-align: left;
background-color: green;
} - 23.True or false: JavaScript changes the page live. (a) False (b) True
- 24.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 100 (d) 1000
- 25.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) sets colours and fonts (d) makes a form box
-
26.✍️ What is the selector in this CSS rule?
h2 {
font-style: italic;
background-color: yellow;
font-size: 20px;
} (a) yellow (b) font-style (c) h2 (d) h1 -
27.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} -
28.✍️ What is the selector in this CSS rule?
p {
font-size: 20px;
font-weight: bold;
} (a) bold (b) p (c) .note (d) font-size - 29.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
-
30.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 430px;
justify-content: space-between;
}
Inside are 4 boxes, each 100px wide (no margins). - 31.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) changes the text size (d) reacts to a button click
- 32.Which of these does CSS do? (a) makes a form box (b) puts a picture on a page (c) reacts to a button click (d) sets colours and fonts
- 33.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
-
34.🖌️ Where does the text sit on its line?
h2 {
font-size: 12px;
color: blue;
text-align: center;
background-color: green;
} (a) on the left (b) in the middle (c) on the right - 35.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
- 36.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
- 37.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
- 38.What does color do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
- 39.Which of these is margin? (a) a solid or dotted edge (b) space inside the border (c) the gap round content (d) the gap to other boxes
-
40.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
}
Answer key
- False
- makes a form box
- #ffffff
- True
- space-between
- black
- False
- white
- JavaScript
- ;
- False
- center
- 132
- HTML
- color
- False
- 24
- 106
- background-color
- white
- the gap round content
- 24
- True
- 255
- makes a form box
- h2
- 14
- p
- many pages
- 10
- reacts to a button click
- sets colours and fonts
- /*
- in the middle
- a class selector
- { }
- align-items
- sets the letter colour
- the gap to other boxes
- 12
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids