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 justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) center (d) flex-start
-
2.⚖️ What colour is the text of this element?
<h1 class="menu" id="main">Hi</h1>
CSS:
.menu { color: purple; }
.menu { color: red; } (a) purple (b) white (c) green (d) red -
3.✍️ What is the selector in this CSS rule?
#top {
width: 300px;
background-color: yellow;
color: red;
font-size: 20px;
} (a) #top (b) li (c) width (d) yellow - 4.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
-
5.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-style: italic;
} - 6.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
- 7.🌈 Which colour of light is strongest in rgb(56, 42, 170)? (a) blue (b) red (c) green
- 8.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
-
9.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
p { color: purple; }
p { color: red; } (a) yellow (b) red (c) green (d) purple - 10.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <a> (d) <img>
- 11.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) red (c) bright green (d) cyan
-
12.✍️ What value is given to color in this rule?
.box {
color: red;
margin: 10px;
} (a) color (b) center (c) red (d) 20px -
13.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
.box { color: red; }
.box { color: white; } (a) purple (b) black (c) white (d) red -
14.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). -
15.🖌️ How big is the text, in px?
p {
font-size: 16px;
background-color: yellow;
color: green;
text-align: right;
} -
16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 15px;
border: 3px solid black;
margin: 5px;
} - 17.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
-
18.✍️ Which property is set to italic in this rule?
.note {
font-size: 20px;
font-style: italic;
padding: 8px;
font-weight: bold;
} (a) font-size (b) font-style (c) color (d) italic - 19.📦 In the box model, which part is space inside the border? (a) content (b) border (c) margin (d) padding
-
20.✍️ What is the selector in this CSS rule?
#top {
font-size: 20px;
padding: 8px;
background-color: yellow;
margin: 10px;
} (a) li (b) font-size (c) 8px (d) #top - 21.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
- 22.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
- 23.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 5 (d) 2
-
24.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). - 25.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) display: flex (c) align-items (d) justify-content
-
26.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} - 27.🎯 What kind of selector is body? (a) an id selector (b) a class selector (c) an element selector
- 28.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
- 29.True or false: HTML makes a form box. (a) False (b) True
-
30.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-size: 20px;
font-weight: bold;
border: 2px solid;
width: 300px;
} - 31.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
-
32.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
.star { color: black; }
#intro { color: blue; }
h1 { color: green; } (a) red (b) green (c) black (d) blue - 33.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
-
34.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 320px;
justify-content: flex-start;
}
Inside are 3 boxes, each 100px wide (no margins). - 35.🌈 Which colour is #00ff00? (a) bright green (b) red (c) cyan (d) yellow
-
36.🖌️ Where does the text sit on its line?
h1 {
font-size: 24px;
color: orange;
text-align: left;
background-color: green;
} (a) on the left (b) on the right (c) in the middle - 37.🌈 In #c00000 the red part is the hex number c0. What is it as a normal number?
- 38.✍️ Which sign goes between a property and its value? (a) : (b) = (c) - (d) ;
- 39.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
-
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins).
Answer key
- flex-end
- red
- #top
- HTML
- 1
- the screen width
- blue
- 800px or wider
- red
- <link>
- bright green
- red
- white
- 70
- 16
- 166
- padding
- font-style
- padding
- #top
- blue
- color
- 1
- 30
- justify-content
- 16
- an element selector
- HTML
- True
- 4
- CSS
- blue
- content
- 20
- bright green
- on the left
- 192
- :
- HTML
- 20
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids