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 language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
- 2.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) red (c) bright green (d) blue
-
3.🖌️ How big is the text, in px?
h1 {
font-size: 24px;
text-align: right;
color: blue;
background-color: black;
} -
4.🎯 Which CSS selector matches this element?
<span class="note" id="end">Hello</span> (a) p (b) span (c) #note (d) .big -
5.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} -
6.🖌️ What colour is behind the letters?
p {
text-align: right;
background-color: green;
font-size: 32px;
color: orange;
} (a) black (b) orange (c) green -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
8.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 9.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
-
10.🖌️ What colour is behind the letters?
h2 {
background-color: black;
color: blue;
font-size: 36px;
text-align: center;
} (a) black (b) blue (c) green - 11.🌈 Which colour of light is strongest in rgb(206, 110, 47)? (a) red (b) blue (c) green
-
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 450px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). -
13.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} -
14.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} - 16.Which of these is the border? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) the gap to other boxes
- 17.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 18.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
- 19.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
-
20.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 440px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). - 21.True or false: body is an id selector. (a) False (b) True
- 22.🎯 Which element does the selector .big style? (a) <h1 class="red"> (b) <h2 class="box"> (c) <h1 id="big"> (d) <h1 class="big">
- 23.True or false: HTML gives the page structure. (a) True (b) False
-
24.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 300px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). - 25.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
-
26.⚖️ What colour is the text of this element?
<h1 class="menu" id="top">Hi</h1>
CSS:
.menu { color: red; }
h1 { color: blue; } (a) orange (b) yellow (c) blue (d) red - 27.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 28.💪 Which flexbox property turns on flexbox? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
- 29.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
- 30.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
-
31.⚖️ What colour is the text of this element?
<p class="menu" id="main">Hi</p>
CSS:
p { color: red; }
#main { color: purple; } (a) orange (b) blue (c) purple (d) red - 32.📦 In the box model, which part is the gap round content? (a) content (b) border (c) margin (d) padding
-
33.🖌️ What colour are the letters?
p {
font-size: 16px;
background-color: red;
text-align: right;
color: orange;
} (a) orange (b) white (c) red -
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 35.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
-
36.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
#hero { color: yellow; }
p { color: purple; }
.big { color: blue; } (a) blue (b) white (c) yellow (d) purple -
37.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
.star { color: white; }
#logo { color: black; } (a) black (b) white (c) orange (d) blue - 38.What does font-weight do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) centres a heading
-
39.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
#main { color: yellow; }
.box { color: blue; }
p { color: green; } (a) green (b) blue (c) yellow (d) white - 40.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
Answer key
- CSS
- red
- 24
- span
- 16
- green
- 240
- 60
- .
- black
- red
- 70
- 14
- 16
- 164
- a solid or dotted edge
- an id selector
- HTML
- 600px or narrower
- 60
- False
- <h1 class="big">
- True
- 20
- packs boxes at the end
- red
- an element selector
- display: flex
- packs boxes at the start
- the viewport meta tag
- purple
- padding
- orange
- 80
- 800px or wider
- yellow
- black
- makes the text bold
- yellow
- fits every screen
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids