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.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} - 2.🌈 Which colour is #00ffff? (a) white (b) red (c) cyan (d) yellow
- 3.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes a form box (d) rounds box corners
- 4.🧩 Which language puts a picture on a page? (a) JavaScript (b) HTML (c) CSS
- 5.🎯 Which element does the selector .star style? (a) <h1 class="note"> (b) <p class="menu"> (c) <p class="star"> (d) <p id="star">
- 6.🌈 Which colour is #ff0000? (a) red (b) yellow (c) blue (d) bright green
- 7.🎯 What kind of selector is img? (a) an element selector (b) an id selector (c) a class selector
-
8.🖌️ How big is the text, in px?
p {
color: purple;
font-size: 28px;
background-color: black;
text-align: left;
} - 9.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
- 10.Which of these is the border? (a) space inside the border (b) the text or picture (c) the gap to other boxes (d) a solid or dotted edge
- 11.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
- 12.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 1 (d) 5
-
13.⚖️ What colour is the text of this element?
<h1 class="red" id="intro">Hi</h1>
CSS:
.red { color: red; }
.red { color: white; } (a) purple (b) red (c) blue (d) white - 14.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) gap (d) flex-direction
-
15.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
.red { color: purple; }
#top { color: orange; } (a) purple (b) yellow (c) orange (d) green - 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
- 17.🎯 Which element does the selector .big style? (a) <span class="big"> (b) <span id="big"> (c) <p class="box"> (d) <span class="red">
-
18.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
h2 { color: green; }
h2 { color: red; } (a) blue (b) green (c) black (d) red -
19.🖌️ How big is the text, in px?
h1 {
font-size: 20px;
background-color: red;
color: purple;
text-align: left;
} - 20.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
-
21.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} -
22.✍️ What value is given to width in this rule?
li {
width: 300px;
font-size: 20px;
text-align: center;
} (a) 300px (b) red (c) italic (d) width - 23.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
- 24.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
- 25.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
- 26.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
- 27.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
-
28.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 20px;
border: 2px solid black;
margin: 10px;
} -
30.🖌️ What colour is behind the letters?
p {
background-color: purple;
font-size: 28px;
text-align: center;
color: black;
} (a) purple (b) black (c) yellow - 31.📦 In the box model, which part is space inside the border? (a) margin (b) content (c) padding (d) border
- 32.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
- 33.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) text-align (d) color
- 34.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
-
35.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
.red { color: black; }
#intro { color: yellow; } (a) orange (b) yellow (c) blue (d) black - 36.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-family (d) font-weight
-
37.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
.big { color: purple; }
.big { color: red; } (a) blue (b) red (c) purple (d) orange - 38.True or false: CSS makes a link. (a) False (b) True
- 39.🌈 In #a50000 the red part is the hex number a5. What is it as a normal number?
-
40.🖌️ What colour is behind the letters?
li {
text-align: right;
color: yellow;
font-size: 36px;
background-color: green;
} (a) red (b) yellow (c) green
Answer key
- 148
- cyan
- rounds box corners
- HTML
- <p class="star">
- red
- an element selector
- 28
- justify-content
- a solid or dotted edge
- packs boxes at the end
- 1
- white
- align-items
- orange
- the later one
- <span class="big">
- red
- 20
- red
- 14
- 300px
- color
- HTML
- JavaScript
- CSS
- CSS
- No
- 104
- purple
- padding
- a class selector
- font-family
- flex-start
- yellow
- background-color
- red
- False
- 165
- green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids