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.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) padding (d) margin
- 2.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) background-color (d) text-align
- 3.True or false: HTML makes a form box. (a) True (b) False
-
4.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). -
5.✍️ Which property is set to 10px in this rule?
.note {
font-style: italic;
margin: 10px;
} (a) margin (b) padding (c) 10px (d) font-weight - 6.🌈 Which colour of light is strongest in rgb(33, 214, 78)? (a) green (b) blue (c) red
-
7.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
#intro { color: purple; }
#intro { color: green; } (a) green (b) purple (c) yellow (d) orange - 8.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) text-align (d) font-family
- 9.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
- 10.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
-
11.🖌️ What colour is behind the letters?
p {
font-size: 28px;
text-align: center;
color: blue;
background-color: orange;
} (a) blue (b) orange (c) red -
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). -
13.✍️ How many declarations (property: value pairs) are in this rule?
p {
text-align: center;
font-weight: bold;
background-color: yellow;
color: red;
} - 14.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
- 15.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
- 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
-
17.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 18.🖌️ Which CSS property makes the text bold? (a) color (b) text-align (c) font-family (d) font-weight
-
19.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
#hero { color: red; }
p { color: yellow; } (a) red (b) green (c) blue (d) yellow -
20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 20px;
}
} -
21.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 22.True or false: body is an id selector. (a) True (b) False
- 23.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) red (d) blue
-
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 25.🌈 Which colour of light is strongest in rgb(30, 185, 33)? (a) green (b) red (c) blue
-
26.🖌️ What colour is behind the letters?
li {
color: red;
text-align: right;
background-color: orange;
font-size: 20px;
} (a) blue (b) red (c) orange -
27.🎯 Which CSS selector matches this element?
<h1 class="big" id="hero">Hello</h1> (a) h2 (b) #hero (c) .red (d) #big -
28.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 410px;
justify-content: flex-start;
}
Inside are 4 boxes, each 100px wide (no margins). - 29.True or false: margin is space outside the border. (a) True (b) False
- 30.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) content (d) margin
- 31.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
- 32.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
- 33.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
- 34.🌈 Which colour is #ff0000? (a) bright green (b) cyan (c) yellow (d) red
- 35.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) rounds box corners (d) makes a form box
- 36.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
- 37.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
- 38.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
-
39.🖌️ What colour is behind the letters?
p {
text-align: left;
color: yellow;
font-size: 36px;
background-color: orange;
} (a) orange (b) yellow (c) blue -
40.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
#intro { color: orange; }
#intro { color: green; } (a) orange (b) green (c) blue (d) purple
Answer key
- margin
- font-size
- True
- 60
- margin
- green
- green
- font-family
- CSS
- ;
- orange
- 20
- 4
- CSS
- :
- the later one
- Yes
- font-weight
- red
- 12
- Yes
- False
- red
- 50
- green
- orange
- #hero
- 10
- True
- padding
- an element selector
- equal gaps, none at ends
- the viewport meta tag
- red
- rounds box corners
- the screen width
- 600px or narrower
- content
- orange
- green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids