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: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} - 2.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
- 3.Which of these does JavaScript do? (a) lays out the page (b) counts down a timer (c) changes the text size (d) rounds box corners
-
4.🎯 Which CSS selector matches this element?
<h2 class="note" id="intro">Hello</h2> (a) #main (b) .big (c) .intro (d) .note -
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). -
6.⚖️ What colour is the text of this element?
<h2 class="big" id="main">Hi</h2>
CSS:
#main { color: green; }
#main { color: orange; } (a) purple (b) green (c) yellow (d) orange - 7.Which of these does CSS do? (a) gives the page structure (b) lays out the page (c) counts down a timer (d) changes the page live
- 8.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
- 9.What does justify-content: center 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
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
11.🎯 Which CSS selector matches this element?
<h1 class="big" id="hero">Hello</h1> (a) .red (b) h2 (c) #hero (d) .hero - 12.Which of these does HTML do? (a) rounds box corners (b) adds space around boxes (c) lays out the page (d) puts a picture on a page
-
13.✍️ Which property is set to 300px in this rule?
body {
width: 300px;
color: red;
} (a) 300px (b) font-style (c) width (d) color - 14.🖌️ Which CSS property centres a heading? (a) font-weight (b) color (c) background-color (d) text-align
- 15.💪 Which flexbox property turns on flexbox? (a) justify-content (b) align-items (c) flex-direction (d) display: flex
-
16.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} - 17.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) flex-start (d) space-between
- 18.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
-
19.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 220px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} -
20.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} -
21.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
22.🎯 Which CSS selector matches this element?
<h1 class="box" id="logo">Hello</h1> (a) .logo (b) .box (c) h2 (d) #box - 23.Which of these is padding? (a) the text or picture (b) the gap to other boxes (c) a solid or dotted edge (d) the gap round content
-
24.✍️ Which property is set to italic in this rule?
h1 {
font-style: italic;
padding: 8px;
color: red;
margin: 10px;
} (a) italic (b) color (c) font-style (d) font-size -
25.✍️ Which property is set to center in this rule?
p {
font-style: italic;
text-align: center;
} (a) margin (b) center (c) text-align (d) background-color - 26.🖌️ Which CSS property picks the font style? (a) font-size (b) font-weight (c) text-align (d) font-family
-
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 28.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
- 29.True or false: #logo is an id selector. (a) True (b) False
-
30.🎯 Which CSS selector matches this element?
<li class="box" id="intro">Hello</li> (a) .intro (b) .box (c) .star (d) #box -
31.🎯 Which CSS selector matches this element?
<span class="red" id="intro">Hello</span> (a) .box (b) #main (c) .red (d) #red - 32.🎯 Which element does the selector span style? (a) <span class="box"> (b) <p> (c) <h1 class="box"> (d) <h2 id="main">
- 33.Which of these does HTML do? (a) changes the text size (b) lays out the page (c) shows a pop-up message (d) gives the page structure
-
34.✍️ Which property is set to 300px in this rule?
li {
text-align: center;
padding: 8px;
font-size: 20px;
width: 300px;
} (a) 300px (b) color (c) font-style (d) width - 35.True or false: margin is the gap round content. (a) True (b) False
- 36.🔍 Which is the odd one out? (a) makes a link (b) rounds box corners (c) adds space around boxes (d) sets colours and fonts
-
37.✍️ What value is given to text-align in this rule?
h1 {
padding: 8px;
margin: 10px;
border: 2px solid;
text-align: center;
} (a) text-align (b) yellow (c) 10px (d) center - 38.🔍 Which is the odd one out? (a) rounds box corners (b) changes the text size (c) lays out the page (d) counts down a timer
- 39.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
- 40.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
Answer key
- 22
- HTML
- counts down a timer
- .note
- 10
- orange
- lays out the page
- color
- puts boxes in the middle
- 198
- #hero
- puts a picture on a page
- width
- text-align
- display: flex
- 82
- flex-start
- /*
- 244
- 26
- 60
- .box
- the gap round content
- font-style
- text-align
- font-family
- 122
- :
- True
- .box
- .red
- <span class="box">
- gives the page structure
- width
- False
- makes a link
- center
- counts down a timer
- JavaScript
- an element selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids