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.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 2.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} -
4.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} -
5.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: green; } (a) black (b) purple (c) orange (d) green - 6.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
-
7.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 100px;
justify-content: space-between;
}
Inside are 2 boxes, each 40px wide (no margins). - 8.What does justify-content: flex-start 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
- 9.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) border (d) padding
- 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
-
11.🖌️ What colour are the letters?
li {
text-align: right;
font-size: 32px;
color: orange;
background-color: purple;
} (a) black (b) purple (c) orange -
12.🖌️ What colour is behind the letters?
p {
font-size: 20px;
background-color: green;
text-align: left;
color: black;
} (a) green (b) yellow (c) black -
13.✍️ What value is given to font-style in this rule?
#top {
color: red;
background-color: yellow;
text-align: center;
font-style: italic;
} (a) font-style (b) red (c) 20px (d) italic - 14.🔍 Which is the odd one out? (a) sets colours and fonts (b) makes a form box (c) puts a picture on a page (d) makes a link
-
15.⚖️ What colour is the text of this element?
<p class="menu" id="main">Hi</p>
CSS:
.menu { color: green; }
#main { color: yellow; }
p { color: white; } (a) white (b) green (c) purple (d) yellow -
16.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} - 17.✍️ In color: blue; which part is the value? (a) color (b) : (c) blue (d) ;
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 15px;
border: 5px solid black;
margin: 20px;
} - 19.True or false: CSS sets colours and fonts. (a) True (b) False
- 20.🖌️ Which CSS property makes the text bold? (a) font-family (b) text-align (c) font-weight (d) color
- 21.True or false: the border is a solid or dotted edge. (a) False (b) True
-
22.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
.big { color: orange; }
p { color: black; }
#main { color: green; } (a) blue (b) green (c) black (d) orange -
23.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 380px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). - 24.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
-
25.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
text-align: center;
margin: 10px;
color: red;
border: 2px solid;
} - 26.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
-
27.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} (a) Yes (b) No - 28.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <div class="star"> (c) <span class="menu"> (d) <div class="box">
- 29.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
- 30.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
-
31.✍️ Which property is set to 20px in this rule?
body {
font-size: 20px;
font-weight: bold;
border: 2px solid;
} (a) background-color (b) 20px (c) font-size (d) text-align -
32.🎯 Which CSS selector matches this element?
<h2 class="star" id="hero">Hello</h2> (a) h2 (b) .hero (c) li (d) #star - 33.🎯 Which sign starts an id selector? (a) # (b) & (c) . (d) @
-
34.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
35.✍️ Which property is set to 300px in this rule?
.box {
color: red;
width: 300px;
} (a) width (b) 300px (c) font-style (d) color -
36.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 120px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). -
37.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
.red { color: black; }
.red { color: red; } (a) blue (b) red (c) black (d) purple - 38.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
-
39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 40.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) font-family (d) background-color
Answer key
- No
- flex-start
- 132
- 24
- green
- Cascading Style Sheets
- 20
- packs boxes at the start
- padding
- the later one
- orange
- green
- italic
- sets colours and fonts
- yellow
- 22
- blue
- 250
- True
- font-weight
- True
- green
- 20
- JavaScript
- 4
- .
- No
- <div class="box">
- 1
- an id selector
- font-size
- h2
- #
- No
- width
- 20
- red
- JavaScript
- 254
- font-family
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids