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: HTML makes headings and lists. (a) True (b) False
- 2.Which of these does CSS do? (a) adds space around boxes (b) shows a pop-up message (c) gives the page structure (d) puts a picture on a page
- 3.Which of these is margin? (a) space outside the border (b) a solid or dotted edge (c) space inside the border (d) the gap round content
- 4.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) text-align (d) font-family
- 5.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
- 6.True or false: CSS gives the page structure. (a) False (b) True
-
7.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} -
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 9.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
- 10.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) space-between (d) flex-end
-
11.✍️ What value is given to margin in this rule?
.box {
font-weight: bold;
margin: 10px;
} (a) bold (b) 10px (c) margin (d) 8px -
12.🎯 Which CSS selector matches this element?
<div class="box" id="intro">Hello</div> (a) .intro (b) .star (c) #intro (d) span -
13.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} - 14.🖌️ Which CSS property colours behind the text? (a) font-size (b) background-color (c) font-weight (d) color
- 15.Which of these does JavaScript do? (a) makes headings and lists (b) lays out the page (c) gives the page structure (d) reacts to a button click
-
16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} - 17.What does background-color do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) colours behind the text
- 18.True or false: margin is space inside the border. (a) False (b) True
-
19.🎯 Which CSS selector matches this element?
<li class="star" id="end">Hello</li> (a) #star (b) .end (c) #end (d) div - 20.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
-
21.⚖️ What colour is the text of this element?
<h2 class="red" id="main">Hi</h2>
CSS:
.red { color: green; }
#main { color: yellow; } (a) green (b) yellow (c) orange (d) purple - 22.What does color do? (a) sets the letter colour (b) colours behind the text (c) centres a heading (d) makes letters bigger
-
23.✍️ What value is given to font-size in this rule?
#top {
font-size: 20px;
background-color: yellow;
} (a) font-size (b) 20px (c) yellow (d) center - 24.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 25.🎯 Which element does the selector .menu style? (a) <li class="note"> (b) <li class="menu"> (c) <div class="big"> (d) <li id="menu">
-
26.🖌️ What colour are the letters?
h1 {
background-color: blue;
text-align: left;
color: red;
font-size: 16px;
} (a) red (b) blue (c) black -
27.🖌️ What colour is behind the letters?
h2 {
font-size: 36px;
background-color: blue;
color: green;
text-align: center;
} (a) orange (b) blue (c) green -
28.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 5px;
border: 3px solid black;
margin: 5px;
} - 30.🎯 What kind of selector is li? (a) an element selector (b) a class selector (c) an id selector
- 31.🌈 In #0000a3 the blue part is the hex number a3. What is it as a normal number?
- 32.🌈 Which hex code is red? (a) #00ffff (b) #000000 (c) #0000ff (d) #ff0000
-
33.🎯 Which CSS selector matches this element?
<div class="note" id="intro">Hello</div> (a) #note (b) span (c) #intro (d) .big - 34.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
- 35.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
- 36.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
-
37.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
h1 { color: black; }
.box { color: yellow; } (a) yellow (b) black (c) blue (d) green -
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 39.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the viewport meta tag (d) the br tag
- 40.True or false: JavaScript lays out the page. (a) False (b) True
Answer key
- True
- adds space around boxes
- space outside the border
- color
- HTML
- False
- 16
- 156
- packs boxes at the end
- flex-start
- 10px
- #intro
- 16
- background-color
- reacts to a button click
- 24
- colours behind the text
- False
- #end
- { }
- yellow
- sets the letter colour
- 20px
- an id selector
- <li class="menu">
- red
- blue
- 20
- 196
- an element selector
- 163
- #ff0000
- #intro
- HTML
- #
- border
- yellow
- 70
- the viewport meta tag
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids