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 CSS property makes the text bold? (a) color (b) background-color (c) text-align (d) font-weight
- 2.True or false: padding is space outside the border. (a) True (b) False
- 3.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
- 4.What does font-family do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) makes letters bigger
- 5.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
- 6.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
- 7.What does font-size do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) makes the text bold
-
8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} -
9.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} - 10.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
- 11.🔍 Which is the odd one out? (a) shows a pop-up message (b) puts a picture on a page (c) makes headings and lists (d) gives the page structure
- 12.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
-
13.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
.star { color: yellow; }
.star { color: red; } (a) yellow (b) black (c) purple (d) red - 14.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) gap (c) display: flex (d) align-items
-
15.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} - 16.Which of these does HTML do? (a) sets colours and fonts (b) reacts to a button click (c) puts a picture on a page (d) rounds box corners
-
17.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 230px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). -
18.✍️ What is the selector in this CSS rule?
.note {
text-align: center;
padding: 8px;
} (a) text-align (b) 8px (c) #top (d) .note -
19.✍️ How many declarations (property: value pairs) are in this rule?
#top {
width: 300px;
} - 20.True or false: HTML reacts to a button click. (a) True (b) False
- 21.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
- 22.True or false: .star is an element selector. (a) False (b) True
-
23.✍️ Which property is set to 20px in this rule?
body {
font-size: 20px;
color: red;
} (a) text-align (b) 20px (c) font-size (d) background-color -
24.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: green; } (a) white (b) yellow (c) green (d) blue - 25.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
-
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} -
27.✍️ What value is given to font-style in this rule?
li {
margin: 10px;
font-weight: bold;
font-style: italic;
} (a) font-style (b) red (c) 20px (d) italic -
28.✍️ What value is given to font-weight in this rule?
p {
font-size: 20px;
font-weight: bold;
text-align: center;
padding: 8px;
} (a) font-weight (b) 300px (c) bold (d) 2px solid - 29.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
-
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} -
31.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: orange; } (a) red (b) yellow (c) white (d) orange -
32.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
33.✍️ Which property is set to yellow in this rule?
body {
color: red;
background-color: yellow;
} (a) yellow (b) margin (c) background-color (d) padding -
34.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} -
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} -
36.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-style: italic;
padding: 8px;
font-weight: bold;
} - 37.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
- 38.What does font-weight do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) makes the text bold
-
39.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 40.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) cyan (c) blue (d) bright green
Answer key
- font-weight
- False
- an id selector
- picks the font style
- CSS
- a class selector
- makes letters bigger
- 8
- 22
- packs boxes at the start
- shows a pop-up message
- .css
- red
- display: flex
- 28
- puts a picture on a page
- 70
- .note
- 1
- False
- a class selector
- False
- font-size
- green
- the later one
- 96
- italic
- bold
- ;
- 340
- orange
- 150
- background-color
- 18
- 92
- 3
- /*
- makes the text bold
- 20
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids