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 of these is the border? (a) space inside the border (b) the text or picture (c) a solid or dotted edge (d) space outside the border
-
2.🖌️ How big is the text, in px?
li {
font-size: 36px;
text-align: right;
color: red;
background-color: blue;
} -
3.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-size: 20px;
} - 4.🖌️ Which CSS property makes letters bigger? (a) color (b) font-family (c) font-size (d) background-color
- 5.🌈 In #0000c6 the blue part is the hex number c6. What is it as a normal number?
- 6.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
- 7.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
-
8.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 330px;
justify-content: flex-start;
}
Inside are 4 boxes, each 80px wide (no margins). -
9.✍️ Which property is set to 10px in this rule?
#top {
margin: 10px;
font-weight: bold;
} (a) font-weight (b) margin (c) padding (d) 10px -
10.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
11.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} - 12.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
- 13.🎯 Can many elements share the same class? (a) Yes (b) No
-
14.✍️ How many declarations (property: value pairs) are in this rule?
#top {
margin: 10px;
color: red;
padding: 8px;
border: 2px solid;
} - 15.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
-
16.✍️ What is the selector in this CSS rule?
body {
padding: 8px;
font-size: 20px;
} (a) 20px (b) padding (c) body (d) .box - 17.🖌️ Which CSS property makes the text bold? (a) color (b) font-weight (c) text-align (d) font-size
- 18.✍️ In color: blue; which part is the value? (a) ; (b) : (c) color (d) blue
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 3 boxes, each 60px wide (no margins). -
20.✍️ How many declarations (property: value pairs) are in this rule?
.box {
padding: 8px;
} - 21.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
- 22.True or false: margin is space outside the border. (a) False (b) True
-
23.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 24.True or false: .card is an id selector. (a) True (b) False
-
25.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 26.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) never changes (d) has no pictures
- 27.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
-
28.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} -
29.🖌️ How big is the text, in px?
h2 {
font-size: 40px;
color: green;
text-align: left;
background-color: white;
} - 30.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) adds space around boxes (d) changes the page live
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 32.🎯 Which sign starts a class selector? (a) & (b) # (c) . (d) @
- 33.🌈 In #00ee00 the green part is the hex number ee. What is it as a normal number?
-
34.🖌️ Where does the text sit on its line?
h2 {
text-align: left;
font-size: 32px;
color: purple;
background-color: yellow;
} (a) in the middle (b) on the right (c) on the left - 35.True or false: #logo is an id selector. (a) False (b) True
-
36.⚖️ What colour is the text of this element?
<p class="red" id="end">Hi</p>
CSS:
#end { color: orange; }
#end { color: purple; } (a) black (b) purple (c) orange (d) white - 37.🌈 Which colour is rgb(0, 255, 0)? (a) red (b) cyan (c) white (d) bright green
-
38.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
39.✍️ What is the selector in this CSS rule?
#top {
font-size: 20px;
width: 300px;
margin: 10px;
color: red;
} (a) #top (b) li (c) font-size (d) 300px -
40.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
#end { color: black; }
.note { color: green; }
h1 { color: red; } (a) red (b) green (c) white (d) black
Answer key
- a solid or dotted edge
- 36
- 1
- font-size
- 198
- <link>
- CSS
- 10
- margin
- 30
- 28
- blue
- Yes
- 4
- .css
- body
- font-weight
- blue
- 30
- 1
- the viewport meta tag
- True
- No
- False
- No
- fits every screen
- HTML
- 20
- 40
- changes the page live
- 120
- .
- 238
- on the left
- True
- purple
- bright green
- No
- #top
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids