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.📦 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: 25px;
border: 3px solid black;
margin: 10px;
} -
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} -
3.🎯 Which CSS selector matches this element?
<li class="note" id="intro">Hello</li> (a) li (b) #note (c) .big (d) .intro -
4.✍️ What value is given to background-color in this rule?
li {
padding: 8px;
font-size: 20px;
background-color: yellow;
} (a) background-color (b) yellow (c) 8px (d) 10px -
5.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). - 6.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) checks a quiz answer (d) gives the page structure
- 7.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
- 8.🔍 Which is the odd one out? (a) changes the text size (b) sets colours and fonts (c) adds space around boxes (d) makes a link
-
9.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} -
10.✍️ Which property is set to red in this rule?
.box {
font-size: 20px;
color: red;
width: 300px;
} (a) red (b) text-align (c) color (d) font-size - 11.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
- 12.What does font-size do? (a) sets the letter colour (b) colours behind the text (c) makes letters bigger (d) centres a heading
- 13.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) : (d) color
-
14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 170px;
padding: 30px;
border: 3px solid black;
margin: 15px;
} - 15.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
- 16.True or false: margin is the text or picture. (a) False (b) True
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 2px solid black;
margin: 0px;
} - 18.🌈 Which colour of light is strongest in rgb(56, 249, 89)? (a) green (b) red (c) blue
- 19.True or false: .card is an id selector. (a) False (b) True
- 20.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) display: flex (d) flex-direction
- 21.🌈 Which colour is #00ff00? (a) blue (b) white (c) yellow (d) bright green
- 22.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
- 23.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
- 24.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
- 25.True or false: padding is the text or picture. (a) True (b) False
- 26.🌈 Which hex code is white? (a) #ffffff (b) #00ffff (c) #000000 (d) #ff0000
- 27.💪 Which flexbox property picks row or column? (a) align-items (b) gap (c) flex-direction (d) display: flex
-
28.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} -
29.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
#end { color: green; }
.box { color: black; } (a) red (b) green (c) yellow (d) black - 30.🖌️ Which CSS property makes the text bold? (a) font-weight (b) background-color (c) font-family (d) text-align
-
31.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
.star { color: yellow; }
h2 { color: black; } (a) black (b) orange (c) red (d) yellow -
32.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
width: 300px;
font-style: italic;
} - 33.🌈 In #7e0000 the red part is the hex number 7e. What is it as a normal number?
- 34.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) blue (c) red (d) black
- 35.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
- 36.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
- 37.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
- 38.True or false: JavaScript puts a picture on a page. (a) False (b) True
-
39.🎯 Which CSS selector matches this element?
<li class="menu" id="top">Hello</li> (a) #intro (b) .note (c) #menu (d) #top -
40.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
.star { color: black; }
.star { color: red; } (a) purple (b) orange (c) red (d) black
Answer key
- 206
- 150
- li
- yellow
- 50
- checks a quiz answer
- CSS
- makes a link
- 16
- color
- CSS
- makes letters bigger
- blue
- 236
- 600px or narrower
- False
- 234
- green
- False
- justify-content
- bright green
- ;
- an element selector
- the screen width
- False
- #ffffff
- flex-direction
- 16
- green
- font-weight
- yellow
- 2
- 126
- red
- HTML
- HTML
- an id selector
- False
- #top
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids