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.✍️ What value is given to padding in this rule?
p {
border: 2px solid;
padding: 8px;
color: red;
width: 300px;
} (a) padding (b) 2px solid (c) bold (d) 8px - 2.🖌️ Which CSS property centres a heading? (a) text-align (b) color (c) font-weight (d) font-size
- 3.Which of these is padding? (a) the text or picture (b) the line round the box (c) a solid or dotted edge (d) space inside the border
- 4.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
- 5.True or false: HTML changes the text size. (a) False (b) True
- 6.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
- 7.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
-
8.✍️ What is the selector in this CSS rule?
body {
border: 2px solid;
font-size: 20px;
} (a) border (b) .box (c) 20px (d) body - 9.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="box"> (c) <div class="box"> (d) <span id="main">
- 10.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
-
11.✍️ How many declarations (property: value pairs) are in this rule?
body {
text-align: center;
font-style: italic;
font-size: 20px;
color: red;
} -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} - 13.Which of these does CSS do? (a) reacts to a button click (b) lays out the page (c) makes headings and lists (d) changes the page live
- 14.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 100 (d) 99
-
15.✍️ Which property is set to italic in this rule?
h2 {
font-style: italic;
background-color: yellow;
font-weight: bold;
} (a) color (b) italic (c) font-size (d) font-style - 16.True or false: #end is an id selector. (a) False (b) True
-
17.✍️ What value is given to width in this rule?
body {
border: 2px solid;
width: 300px;
} (a) red (b) 300px (c) width (d) italic - 18.🎯 Which sign starts an id selector? (a) . (b) # (c) @ (d) &
-
19.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
#hero { color: yellow; }
#hero { color: purple; } (a) black (b) yellow (c) purple (d) red -
20.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
h1 { color: yellow; }
.note { color: white; } (a) green (b) yellow (c) white (d) red -
21.✍️ How many declarations (property: value pairs) are in this rule?
p {
padding: 8px;
border: 2px solid;
} -
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 230px;
justify-content: center;
}
Inside are 3 boxes, each 50px wide (no margins). - 23.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
-
24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 230px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} - 25.Which of these is the border? (a) the text or picture (b) the gap to other boxes (c) space inside the border (d) a solid or dotted edge
- 26.🎯 What kind of selector is .card? (a) a class selector (b) an id selector (c) an element selector
- 27.🌈 In #00a800 the green part is the hex number a8. What is it as a normal number?
-
28.✍️ Which property is set to 8px in this rule?
#top {
padding: 8px;
border: 2px solid;
font-size: 20px;
} (a) font-weight (b) padding (c) border (d) 8px -
29.🖌️ Where does the text sit on its line?
h1 {
background-color: green;
text-align: left;
font-size: 16px;
color: blue;
} (a) on the left (b) in the middle (c) on the right -
30.✍️ What value is given to text-align in this rule?
h1 {
font-style: italic;
border: 2px solid;
text-align: center;
} (a) center (b) yellow (c) 10px (d) text-align - 31.🖌️ Which CSS property makes the text bold? (a) font-family (b) text-align (c) font-weight (d) font-size
- 32.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
-
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). -
34.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
#intro { color: purple; }
p { color: white; } (a) white (b) purple (c) red (d) black - 35.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
- 36.True or false: padding is the text or picture. (a) True (b) False
- 37.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
- 38.Which of these does HTML do? (a) shows a pop-up message (b) sets colours and fonts (c) changes the text size (d) gives the page structure
-
39.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
p { color: blue; }
p { color: black; } (a) blue (b) black (c) green (d) red - 40.🌈 Which colour is #000000? (a) white (b) black (c) blue (d) magenta
Answer key
- 8px
- text-align
- space inside the border
- color
- False
- the later one
- blue
- body
- <h2 class="box">
- equal gaps, none at ends
- 4
- 156
- lays out the page
- 255
- font-style
- True
- 300px
- #
- purple
- white
- 2
- 40
- 800px or wider
- 260
- a solid or dotted edge
- a class selector
- 168
- padding
- on the left
- center
- font-weight
- CSS
- 50
- purple
- 600px or narrower
- False
- an id selector
- gives the page structure
- black
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids