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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
- 2.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-end (d) flex-start
-
3.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
p { color: black; }
#top { color: orange; }
.note { color: yellow; } (a) yellow (b) orange (c) purple (d) black - 4.True or false: padding is the gap round content. (a) False (b) True
- 5.🎯 Which element does the selector .note style? (a) <p class="big"> (b) <h1 class="red"> (c) <p class="note"> (d) <p id="note">
- 6.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) yellow (d) cyan
- 7.True or false: HTML makes a form box. (a) False (b) True
-
8.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} (a) Yes (b) No - 9.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
-
10.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). -
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 25px;
border: 5px solid black;
margin: 5px;
} - 12.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
- 13.🌈 Which colour of light is strongest in rgb(75, 17, 225)? (a) blue (b) green (c) red
-
14.🖌️ How big is the text, in px?
li {
text-align: left;
background-color: green;
font-size: 36px;
color: blue;
} -
15.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
.red { color: orange; }
.red { color: blue; } (a) orange (b) white (c) blue (d) yellow - 16.🎯 Which element does the selector .menu style? (a) <p class="menu"> (b) <p class="note"> (c) <p id="menu"> (d) <h1 class="big">
-
17.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 440px;
justify-content: flex-start;
}
Inside are 4 boxes, each 100px wide (no margins). - 18.What does color do? (a) makes the text bold (b) makes letters bigger (c) centres a heading (d) sets the letter colour
- 19.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
-
20.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
margin: 10px;
} - 21.What does text-align do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) centres a heading
-
22.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} -
23.✍️ What is the selector in this CSS rule?
.note {
padding: 8px;
background-color: yellow;
text-align: center;
color: red;
} (a) .note (b) yellow (c) padding (d) #top -
24.✍️ Which property is set to 2px solid in this rule?
h2 {
padding: 8px;
border: 2px solid;
} (a) font-style (b) border (c) width (d) 2px solid -
25.⚖️ What colour is the text of this element?
<h1 class="star" id="end">Hi</h1>
CSS:
.star { color: red; }
#end { color: blue; } (a) blue (b) red (c) black (d) purple - 26.Which of these does CSS do? (a) puts a picture on a page (b) rounds box corners (c) makes headings and lists (d) checks a quiz answer
-
27.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
28.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: red; } (a) orange (b) red (c) green (d) blue - 29.📱 What does a media query check? (a) the time of day (b) the screen width (c) the page title (d) the battery level
-
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). - 31.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
32.✍️ How many declarations (property: value pairs) are in this rule?
body {
text-align: center;
margin: 10px;
background-color: yellow;
font-size: 20px;
} -
33.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} (a) Yes (b) No - 34.True or false: .menu is a class selector. (a) True (b) False
-
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 36.True or false: CSS changes the text size. (a) False (b) True
- 37.True or false: .menu is an element selector. (a) False (b) True
- 38.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-weight (c) color (d) text-align
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 30px;
border: 3px solid black;
margin: 10px;
} -
40.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 520px;
justify-content: space-between;
}
Inside are 4 boxes, each 100px wide (no margins).
Answer key
- the later one
- flex-start
- orange
- True
- <p class="note">
- cyan
- True
- No
- a class selector
- 40
- 290
- an element selector
- blue
- 36
- blue
- <p class="menu">
- 40
- sets the letter colour
- HTML
- 1
- centres a heading
- 22
- .note
- border
- blue
- rounds box corners
- 60
- red
- the screen width
- 60
- an id selector
- 4
- Yes
- True
- 50
- True
- False
- font-weight
- 136
- 40
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids