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 CSS selector matches this element?
<h1 class="red" id="intro">Hello</h1> (a) .intro (b) .box (c) #intro (d) h2 -
2.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). - 3.🔍 Which is the odd one out? (a) makes a link (b) reacts to a button click (c) makes a form box (d) gives the page structure
- 4.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) ( ) (d) { }
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 10px;
border: 5px solid black;
margin: 0px;
} -
6.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). -
7.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} -
8.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
.red { color: blue; }
.red { color: green; } (a) blue (b) green (c) purple (d) white -
9.🎯 Which CSS selector matches this element?
<li class="menu" id="hero">Hello</li> (a) .menu (b) #menu (c) #top (d) .hero -
10.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 11.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) background-color (d) text-align
-
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 300px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins). -
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 14.🌈 Which colour of light is strongest in rgb(39, 196, 113)? (a) green (b) red (c) blue
-
15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} - 16.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) space outside the border (d) a solid or dotted edge
-
17.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
background-color: yellow;
padding: 8px;
} -
18.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
.red { color: purple; }
.red { color: orange; } (a) red (b) purple (c) black (d) orange - 19.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
-
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 180px;
padding: 25px;
border: 3px solid black;
margin: 20px;
} - 21.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
-
22.✍️ What is the selector in this CSS rule?
.box {
font-style: italic;
width: 300px;
} (a) 300px (b) .box (c) h2 (d) font-style -
23.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} -
24.🖌️ What colour are the letters?
li {
background-color: blue;
text-align: left;
font-size: 40px;
color: red;
} (a) blue (b) red (c) black -
25.🖌️ How big is the text, in px?
p {
font-size: 32px;
color: purple;
background-color: yellow;
text-align: left;
} -
26.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). -
27.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 15px;
border: 2px solid black;
margin: 15px;
} - 28.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
- 29.⚖️ 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
- 30.🌈 Which colour is rgb(0, 255, 255)? (a) red (b) magenta (c) bright green (d) cyan
-
31.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
32.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 10px;
border: 3px solid black;
margin: 15px;
} - 33.🌈 Which colour is #00ffff? (a) cyan (b) yellow (c) red (d) bright green
- 34.🎯 Which element does the selector .red style? (a) <div id="red"> (b) <div class="box"> (c) <span class="star"> (d) <div class="red">
-
35.🎯 Which CSS selector matches this element?
<p class="big" id="intro">Hello</p> (a) .red (b) #intro (c) #big (d) #main - 36.What does font-weight do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) makes the text bold
- 37.True or false: .star is an element selector. (a) True (b) False
-
38.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
.big { color: blue; }
#logo { color: orange; } (a) black (b) blue (c) orange (d) purple -
39.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-style: italic;
font-weight: bold;
margin: 10px;
} -
40.🎯 Which CSS selector matches this element?
<div class="big" id="hero">Hello</div> (a) .red (b) div (c) .hero (d) #big
Answer key
- #intro
- 40
- reacts to a button click
- { }
- 90
- 20
- 246
- green
- .menu
- No
- font-family
- 30
- 126
- green
- 20
- a solid or dotted edge
- 2
- orange
- Cascading Style Sheets
- 236
- <style>
- .box
- 20
- red
- 32
- 60
- 184
- <link>
- the later one
- cyan
- Yes
- 296
- cyan
- <div class="red">
- #intro
- makes the text bold
- False
- orange
- 3
- div
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids