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.🖌️ What colour are the letters?
h2 {
color: blue;
background-color: red;
text-align: left;
font-size: 16px;
} (a) red (b) blue (c) purple - 2.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
-
3.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
.red { color: purple; }
p { color: black; }
#top { color: yellow; } (a) purple (b) black (c) yellow (d) red -
4.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
border: 2px solid;
text-align: center;
color: red;
} -
5.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 20px;
}
} (a) Yes (b) No -
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} - 7.🌈 Which colour of light is strongest in rgb(28, 59, 230)? (a) red (b) blue (c) green
-
8.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
.big { color: green; }
.big { color: yellow; } (a) orange (b) green (c) yellow (d) black -
9.🖌️ What colour are the letters?
li {
color: green;
text-align: left;
background-color: blue;
font-size: 28px;
} (a) blue (b) orange (c) green - 10.🔍 Which is the odd one out? (a) makes headings and lists (b) lays out the page (c) rounds box corners (d) adds space around boxes
-
11.🖌️ Where does the text sit on its line?
p {
color: black;
font-size: 20px;
text-align: right;
background-color: blue;
} (a) on the right (b) in the middle (c) on the left - 12.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 13.True or false: .big is a class selector. (a) False (b) True
- 14.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
- 15.What does font-family do? (a) picks the font style (b) centres a heading (c) makes letters bigger (d) makes the text bold
-
16.🖌️ What colour is behind the letters?
h1 {
text-align: center;
background-color: green;
font-size: 36px;
color: blue;
} (a) white (b) green (c) blue -
17.🖌️ Where does the text sit on its line?
h2 {
color: purple;
text-align: center;
font-size: 40px;
background-color: red;
} (a) on the left (b) on the right (c) in the middle - 18.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) has no pictures (d) fits every screen
- 19.True or false: the border is the line round the box. (a) True (b) False
- 20.🖌️ Which CSS property colours behind the text? (a) font-family (b) color (c) background-color (d) text-align
-
21.✍️ What is the selector in this CSS rule?
.box {
color: red;
padding: 8px;
margin: 10px;
background-color: yellow;
} (a) 8px (b) color (c) .box (d) h2 - 22.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
23.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 3 boxes, each 100px wide (no margins). - 24.🌈 Which colour is #ff00ff? (a) white (b) magenta (c) yellow (d) bright green
- 25.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
- 26.True or false: #top is an id selector. (a) False (b) True
-
27.🖌️ What colour are the letters?
h1 {
background-color: blue;
text-align: left;
font-size: 40px;
color: yellow;
} (a) orange (b) yellow (c) blue - 28.True or false: the content is a solid or dotted edge. (a) True (b) False
- 29.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
-
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 4 boxes, each 60px wide (no margins). -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} -
32.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} - 33.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) sets colours and fonts (d) gives the page structure
- 34.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
- 35.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) green (d) blue
- 36.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 250px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} - 38.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-size (c) color (d) text-align
- 39.True or false: padding is the gap round content. (a) True (b) False
-
40.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) Yes (b) No
Answer key
- blue
- CSS
- yellow
- 4
- Yes
- 210
- blue
- yellow
- green
- makes headings and lists
- on the right
- an id selector
- True
- flex-end
- picks the font style
- green
- in the middle
- fits every screen
- True
- background-color
- .box
- an element selector
- 30
- magenta
- an element selector
- True
- yellow
- False
- { }
- 10
- 234
- 22
- sets colours and fonts
- ;
- red
- puts boxes in the middle
- 350
- font-weight
- True
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids