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 space inside the border? (a) border (b) padding (c) content (d) margin
- 2.🌈 Which colour is #ffffff? (a) bright green (b) yellow (c) magenta (d) white
-
3.🎯 Which CSS selector matches this element?
<h2 class="big" id="logo">Hello</h2> (a) .big (b) #end (c) .red (d) .logo - 4.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) makes a link (d) rounds box corners
- 5.True or false: CSS sets colours and fonts. (a) True (b) False
- 6.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
- 7.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) flex-start (d) center
- 8.What does font-weight do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
- 9.True or false: #top is an id selector. (a) False (b) True
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
11.🖌️ What colour is behind the letters?
h1 {
font-size: 20px;
text-align: center;
background-color: red;
color: orange;
} (a) red (b) orange (c) purple - 12.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 13.🌈 Which colour of light is strongest in rgb(51, 184, 78)? (a) blue (b) green (c) red
- 14.💪 Which flexbox property sets space between boxes? (a) gap (b) align-items (c) flex-direction (d) display: flex
- 15.What does color do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) makes the text bold
- 16.🌈 Which colour is #ff00ff? (a) yellow (b) blue (c) magenta (d) cyan
- 17.Which of these does CSS do? (a) counts down a timer (b) checks a quiz answer (c) makes headings and lists (d) rounds box corners
-
18.🖌️ What colour are the letters?
li {
background-color: yellow;
color: blue;
text-align: right;
font-size: 32px;
} (a) blue (b) red (c) yellow -
19.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
20.✍️ What is the selector in this CSS rule?
li {
text-align: center;
font-weight: bold;
padding: 8px;
} (a) body (b) text-align (c) bold (d) li -
21.✍️ Which property is set to yellow in this rule?
#top {
background-color: yellow;
width: 300px;
font-size: 20px;
margin: 10px;
} (a) margin (b) yellow (c) background-color (d) padding - 22.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) font-weight (d) text-align
- 23.Which of these does CSS do? (a) puts a picture on a page (b) shows a pop-up message (c) checks a quiz answer (d) changes the text size
- 24.🌈 Which colour is #00ffff? (a) blue (b) red (c) white (d) cyan
-
25.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
26.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). - 27.True or false: #hero is an id selector. (a) False (b) True
-
28.✍️ What value is given to font-style in this rule?
h1 {
font-style: italic;
font-size: 20px;
} (a) font-style (b) red (c) 20px (d) italic -
29.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} -
30.🖌️ How big is the text, in px?
h1 {
color: yellow;
font-size: 28px;
background-color: white;
text-align: left;
} - 31.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) align-items
- 32.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Computer Style Sheets
- 33.🎯 What kind of selector is li? (a) a class selector (b) an element selector (c) an id selector
-
34.🖌️ What colour are the letters?
h2 {
font-size: 20px;
text-align: right;
color: red;
background-color: purple;
} (a) red (b) orange (c) purple -
35.✍️ What is the selector in this CSS rule?
.note {
padding: 8px;
width: 300px;
font-size: 20px;
} (a) 300px (b) #top (c) padding (d) .note - 36.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) center (d) space-between
-
37.🎯 Which CSS selector matches this element?
<span class="big" id="top">Hello</span> (a) .top (b) #big (c) .big (d) #intro - 38.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
-
39.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} -
40.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} (a) Yes (b) No
Answer key
- padding
- white
- .big
- makes a link
- True
- 3
- flex-start
- makes the text bold
- True
- 154
- red
- an id selector
- green
- gap
- sets the letter colour
- magenta
- rounds box corners
- blue
- Yes
- li
- background-color
- font-family
- changes the text size
- cyan
- Yes
- 70
- True
- italic
- 24
- 28
- flex-direction
- Cascading Style Sheets
- an element selector
- red
- .note
- space-between
- .big
- /*
- 192
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids