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.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
-
2.✍️ What value is given to width in this rule?
.note {
font-style: italic;
border: 2px solid;
width: 300px;
padding: 8px;
} (a) red (b) italic (c) width (d) 300px - 3.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
-
4.🖌️ What colour are the letters?
li {
font-size: 28px;
color: orange;
text-align: right;
background-color: green;
} (a) orange (b) yellow (c) green -
5.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 6.Which of these does HTML do? (a) adds space around boxes (b) makes headings and lists (c) counts down a timer (d) rounds box corners
- 7.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
-
8.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-size: 20px;
font-style: italic;
text-align: center;
} - 9.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
- 10.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 11.True or false: .big is a class selector. (a) False (b) True
- 12.True or false: .menu is a class selector. (a) True (b) False
-
13.📱 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;
}
} - 14.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
-
15.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} - 16.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 18.True or false: HTML adds space around boxes. (a) False (b) True
-
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 20.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
-
21.🖌️ What colour are the letters?
h1 {
background-color: red;
font-size: 24px;
text-align: center;
color: purple;
} (a) purple (b) red (c) blue -
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 23.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) font-size (d) background-color
-
24.✍️ Which property is set to red in this rule?
h1 {
color: red;
border: 2px solid;
width: 300px;
background-color: yellow;
} (a) text-align (b) font-size (c) color (d) red -
25.🖌️ Where does the text sit on its line?
h1 {
font-size: 12px;
text-align: center;
color: green;
background-color: blue;
} (a) on the left (b) on the right (c) in the middle - 26.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 27.True or false: HTML checks a quiz answer. (a) False (b) True
-
28.✍️ What is the selector in this CSS rule?
h2 {
padding: 8px;
text-align: center;
margin: 10px;
font-style: italic;
} (a) padding (b) h2 (c) center (d) h1 - 29.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .html (d) .png
-
30.✍️ What is the selector in this CSS rule?
.box {
margin: 10px;
color: red;
} (a) margin (b) h2 (c) red (d) .box -
31.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
#end { color: green; }
.note { color: red; } (a) blue (b) red (c) green (d) orange - 32.What does text-align do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) sets the letter colour
-
33.🎯 Which CSS selector matches this element?
<p class="red" id="hero">Hello</p> (a) h1 (b) .hero (c) p (d) #red - 34.🌈 Which colour is #000000? (a) cyan (b) bright green (c) black (d) blue
-
35.🖌️ What colour is behind the letters?
p {
text-align: right;
color: green;
background-color: orange;
font-size: 12px;
} (a) blue (b) green (c) orange - 36.🌈 Which hex code is black? (a) #000000 (b) #ffffff (c) #0000ff (d) #00ff00
- 37.True or false: the border is space inside the border. (a) True (b) False
- 38.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red
-
39.✍️ How many declarations (property: value pairs) are in this rule?
li {
border: 2px solid;
margin: 10px;
} -
40.✍️ What value is given to text-align in this rule?
p {
font-size: 20px;
text-align: center;
background-color: yellow;
color: red;
} (a) 10px (b) yellow (c) center (d) text-align
Answer key
- 600px or narrower
- 300px
- 800px or wider
- orange
- Yes
- makes headings and lists
- a class selector
- 3
- flex-start
- an id selector
- True
- True
- 28
- equal gaps, none at ends
- 20
- :
- 344
- False
- 50
- HTML
- purple
- 30
- background-color
- color
- in the middle
- an element selector
- False
- h2
- .css
- .box
- green
- centres a heading
- p
- black
- orange
- #000000
- False
- blue
- 2
- center
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids