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.True or false: .note is a class selector. (a) False (b) True
- 2.🎯 What kind of selector is .card? (a) a class selector (b) an id selector (c) an element selector
-
3.✍️ Which property is set to 10px in this rule?
.box {
margin: 10px;
font-size: 20px;
} (a) 10px (b) font-weight (c) margin (d) padding -
4.✍️ Which property is set to 2px solid in this rule?
body {
border: 2px solid;
color: red;
} (a) width (b) 2px solid (c) font-style (d) border - 5.✍️ Which sign goes between a property and its value? (a) : (b) - (c) = (d) ;
- 6.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
-
7.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} -
8.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
.box { color: white; }
p { color: purple; } (a) white (b) yellow (c) orange (d) purple - 9.🌈 Which colour is rgb(0, 0, 255)? (a) bright green (b) blue (c) black (d) red
- 10.True or false: CSS rounds box corners. (a) True (b) False
- 11.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
-
12.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-style: italic;
} -
13.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 14.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) margin (d) border
- 15.🌈 Which hex code is blue? (a) #ffff00 (b) #ff00ff (c) #ffffff (d) #0000ff
-
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 17.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) rounds box corners (d) lays out the page
- 18.🌈 In #001000 the green part is the hex number 10. What is it as a normal number?
-
19.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 190px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). -
20.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 21.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
-
22.🖌️ How big is the text, in px?
h1 {
color: black;
font-size: 40px;
text-align: center;
background-color: green;
} -
23.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
.box { color: black; }
.box { color: yellow; } (a) orange (b) black (c) yellow (d) blue -
24.⚖️ What colour is the text of this element?
<p class="star" id="main">Hi</p>
CSS:
#main { color: yellow; }
p { color: green; }
.star { color: black; } (a) green (b) blue (c) black (d) yellow - 25.Which of these does JavaScript do? (a) makes a form box (b) rounds box corners (c) reacts to a button click (d) makes headings and lists
- 26.✍️ In color: blue; which part is the property? (a) color (b) : (c) ; (d) blue
- 27.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
- 28.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
- 29.Which of these does HTML do? (a) makes a form box (b) counts down a timer (c) checks a quiz answer (d) reacts to a button click
- 30.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
-
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
32.🎯 Which CSS selector matches this element?
<h2 class="red" id="intro">Hello</h2> (a) #main (b) h2 (c) #red (d) li -
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 370px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). -
34.📦 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: 5px;
border: 1px solid black;
margin: 15px;
} - 35.💪 Which flexbox property lines boxes up across? (a) gap (b) align-items (c) display: flex (d) justify-content
-
36.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 37.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
- 38.Which of these is padding? (a) the gap round content (b) the line round the box (c) space outside the border (d) the text or picture
-
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: 30px;
border: 1px solid black;
margin: 10px;
} -
40.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: blue; }
.note { color: orange; } (a) black (b) green (c) orange (d) blue
Answer key
- True
- a class selector
- margin
- border
- :
- 800px or wider
- 24
- white
- blue
- True
- the screen width
- 1
- No
- padding
- #0000ff
- 70
- gives the page structure
- 16
- 10
- No
- ;
- 40
- yellow
- yellow
- reacts to a button click
- color
- an id selector
- JavaScript
- makes a form box
- packs boxes at the start
- 142
- h2
- 70
- 192
- align-items
- Yes
- 1
- the gap round content
- 302
- orange
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids