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 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} -
2.✍️ What is the selector in this CSS rule?
h2 {
width: 300px;
margin: 10px;
color: red;
} (a) h2 (b) width (c) h1 (d) 10px - 3.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) makes a form box (d) rounds box corners
- 4.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) flex-start (d) space-between
- 5.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
- 6.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
- 7.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
-
8.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 9.What does color do? (a) sets the letter colour (b) picks the font style (c) makes letters bigger (d) colours behind the text
-
10.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-size: 20px;
background-color: yellow;
text-align: center;
} - 11.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
- 12.🎯 Which element does the selector .box style? (a) <span class="menu"> (b) <div class="box"> (c) <div class="star"> (d) <div id="box">
-
13.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
font-weight: bold;
color: red;
font-style: italic;
} - 14.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 100 (d) 255
- 15.🌈 In #00ff00 the green part is the hex number ff. What is it as a normal number?
- 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 2px solid black;
margin: 10px;
} - 18.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
-
19.✍️ What is the selector in this CSS rule?
h1 {
font-style: italic;
font-size: 20px;
padding: 8px;
} (a) h1 (b) font-style (c) 20px (d) p -
20.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
font-size: 20px;
} - 21.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) display: flex (d) justify-content
- 22.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 23.🎯 What kind of selector is #main? (a) an element selector (b) an id selector (c) a class selector
- 24.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .js (d) .css
- 25.🖌️ Which CSS property picks the font style? (a) background-color (b) color (c) font-family (d) font-size
- 26.What does font-family do? (a) sets the letter colour (b) centres a heading (c) makes the text bold (d) picks the font style
-
27.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). - 28.🌈 In #000f00 the green part is the hex number 0f. What is it as a normal number?
- 29.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) , (d) ;
-
30.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
margin: 10px;
width: 300px;
border: 2px solid;
} -
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). -
32.🖌️ What colour are the letters?
h2 {
color: blue;
text-align: left;
background-color: green;
font-size: 28px;
} (a) white (b) green (c) blue -
33.✍️ What is the selector in this CSS rule?
li {
border: 2px solid;
font-size: 20px;
} (a) border (b) li (c) body (d) 20px - 34.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) 1 (d) any number
-
35.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 300px;
justify-content: space-between;
}
Inside are 3 boxes, each 60px wide (no margins). -
36.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
p { color: black; }
p { color: orange; } (a) red (b) orange (c) blue (d) black - 37.True or false: margin is the gap round content. (a) False (b) True
-
38.🎯 Which CSS selector matches this element?
<span class="menu" id="top">Hello</span> (a) #top (b) .note (c) .top (d) #intro - 39.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
-
40.✍️ How many declarations (property: value pairs) are in this rule?
body {
background-color: yellow;
border: 2px solid;
width: 300px;
}
Answer key
- 28
- h2
- makes a form box
- flex-start
- HTML
- JavaScript
- :
- 50
- sets the letter colour
- 3
- .
- <div class="box">
- 4
- 255
- 255
- the later one
- 154
- a class selector
- h1
- 2
- flex-direction
- an element selector
- an id selector
- .css
- font-family
- picks the font style
- 20
- 15
- ;
- 3
- 10
- blue
- li
- 1
- 60
- orange
- False
- #top
- HTML
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids