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.🖌️ Which CSS property centres a heading? (a) color (b) text-align (c) font-family (d) background-color
- 2.True or false: padding is the gap round content. (a) True (b) False
-
3.🎯 Which CSS selector matches this element?
<div class="big" id="top">Hello</div> (a) #intro (b) span (c) .red (d) .big -
4.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). - 5.🌈 In #000027 the blue part is the hex number 27. What is it as a normal number?
- 6.What does justify-content: center 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
- 7.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) black (c) white (d) magenta
- 8.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) the text or picture (d) the gap to other boxes
-
9.✍️ How many declarations (property: value pairs) are in this rule?
p {
border: 2px solid;
font-weight: bold;
color: red;
} -
10.💪 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). -
11.🖌️ How big is the text, in px?
h1 {
color: red;
text-align: center;
background-color: green;
font-size: 12px;
} -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} - 13.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
- 14.True or false: .big is an id selector. (a) False (b) True
- 15.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
- 16.🎯 Which element does the selector .note style? (a) <div class="note"> (b) <div class="big"> (c) <div id="note"> (d) <span class="red">
-
17.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
p { color: blue; }
.star { color: white; } (a) green (b) white (c) blue (d) red - 18.🌈 In #340000 the red part is the hex number 34. What is it as a normal number?
- 19.🌈 Which hex code is blue? (a) #00ffff (b) #0000ff (c) #ffffff (d) #000000
-
20.⚖️ What colour is the text of this element?
<h2 class="note" id="logo">Hi</h2>
CSS:
h2 { color: orange; }
#logo { color: blue; } (a) orange (b) purple (c) green (d) blue - 21.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
- 22.🔍 Which is the odd one out? (a) makes a form box (b) adds space around boxes (c) sets colours and fonts (d) rounds box corners
-
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
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: 240px;
padding: 15px;
border: 4px solid black;
margin: 20px;
} -
25.⚖️ What colour is the text of this element?
<h2 class="star" id="top">Hi</h2>
CSS:
h2 { color: white; }
.star { color: red; }
#top { color: blue; } (a) purple (b) blue (c) red (d) white -
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 230px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). -
27.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
28.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: black; } (a) yellow (b) red (c) blue (d) black - 29.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
-
30.⚖️ What colour is the text of this element?
<h1 class="big" id="end">Hi</h1>
CSS:
.big { color: red; }
h1 { color: green; } (a) red (b) green (c) purple (d) white -
31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} -
32.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 210px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 33.🌈 Which colour of light is strongest in rgb(91, 43, 169)? (a) red (b) green (c) blue
- 34.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 35.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
-
36.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). - 37.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) align-items (d) justify-content
-
38.🎯 Which CSS selector matches this element?
<h2 class="menu" id="intro">Hello</h2> (a) #menu (b) .menu (c) .note (d) #main -
39.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 40.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
Answer key
- text-align
- True
- .big
- 10
- 39
- puts boxes in the middle
- magenta
- a solid or dotted edge
- 3
- 70
- 12
- 342
- the later one
- False
- JavaScript
- <div class="note">
- white
- 52
- #0000ff
- blue
- color
- makes a form box
- 252
- 278
- blue
- 30
- 50
- black
- HTML
- red
- 26
- 10
- blue
- HTML
- fits every screen
- 40
- flex-direction
- .menu
- 18
- { }
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids