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.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
- 2.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) margin (d) border
-
3.✍️ Which property is set to italic in this rule?
p {
font-style: italic;
font-size: 20px;
} (a) color (b) font-size (c) font-style (d) italic - 4.True or false: CSS shows a pop-up message. (a) False (b) True
-
5.✍️ What value is given to padding in this rule?
p {
padding: 8px;
border: 2px solid;
} (a) 8px (b) bold (c) 2px solid (d) padding - 6.🔍 Which is the odd one out? (a) gives the page structure (b) changes the page live (c) makes a form box (d) makes a link
- 7.🌈 In #000d00 the green part is the hex number 0d. What is it as a normal number?
-
8.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). -
9.🖌️ What colour are the letters?
h1 {
font-size: 20px;
color: black;
background-color: purple;
text-align: left;
} (a) black (b) red (c) purple - 10.🌈 Which hex code is yellow? (a) #00ff00 (b) #ffff00 (c) #000000 (d) #ff0000
- 11.True or false: li is an element selector. (a) False (b) True
- 12.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) only one image (d) many pages
- 13.True or false: padding is space inside the border. (a) False (b) True
- 14.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]
- 15.🌈 Which colour of light is strongest in rgb(176, 69, 50)? (a) blue (b) green (c) red
-
16.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 380px;
justify-content: space-between;
}
Inside are 4 boxes, each 50px wide (no margins). - 17.🎯 Which element does the selector .big style? (a) <span class="red"> (b) <span id="big"> (c) <p class="box"> (d) <span class="big">
-
18.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 19.What does font-size do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) picks the font style
-
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 300px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). -
21.✍️ What is the selector in this CSS rule?
li {
margin: 10px;
text-align: center;
font-weight: bold;
} (a) li (b) body (c) center (d) margin - 22.🌈 In #540000 the red part is the hex number 54. What is it as a normal number?
- 23.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
- 24.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
- 25.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 255 (d) 99
- 26.🔍 Which is the odd one out? (a) adds space around boxes (b) counts down a timer (c) sets colours and fonts (d) changes the text size
- 27.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
- 28.Which of these does CSS do? (a) makes a form box (b) makes headings and lists (c) adds space around boxes (d) shows a pop-up message
- 29.🌈 Which colour of light is strongest in rgb(124, 20, 151)? (a) red (b) blue (c) green
-
30.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-size: 20px;
font-style: italic;
text-align: center;
} - 31.🎯 What kind of selector is h1? (a) an element selector (b) a class selector (c) an id selector
-
32.🎯 Which CSS selector matches this element?
<div class="red" id="hero">Hello</div> (a) .hero (b) #top (c) #hero (d) .box -
33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} -
34.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
35.⚖️ What colour is the text of this element?
<h2 class="box" id="intro">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: blue; } (a) blue (b) red (c) green (d) orange -
36.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} -
37.🖌️ What colour is behind the letters?
h1 {
font-size: 28px;
text-align: right;
background-color: orange;
color: red;
} (a) white (b) orange (c) red - 38.Which of these does HTML do? (a) lays out the page (b) adds space around boxes (c) reacts to a button click (d) makes a form box
- 39.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
-
40.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 420px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins).
Answer key
- picks the font style
- padding
- font-style
- False
- 8px
- changes the page live
- 13
- 20
- black
- #ffff00
- True
- many pages
- True
- { }
- red
- 60
- <span class="big">
- No
- makes letters bigger
- 60
- li
- 84
- JavaScript
- flex-end
- 255
- counts down a timer
- 800px or wider
- adds space around boxes
- blue
- 3
- an element selector
- #hero
- 18
- 10
- blue
- 12
- orange
- makes a form box
- /*
- 60
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids