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 justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) flex-start (d) center
-
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} -
3.✍️ How many declarations (property: value pairs) are in this rule?
p {
text-align: center;
background-color: yellow;
font-weight: bold;
font-size: 20px;
} - 4.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
- 5.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
-
6.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
p { color: orange; }
p { color: green; } (a) orange (b) yellow (c) green (d) blue -
7.🎯 Which CSS selector matches this element?
<span class="star" id="logo">Hello</span> (a) p (b) .menu (c) #end (d) #logo -
8.💪 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). - 9.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
- 10.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
- 11.🌈 Which colour is #00ffff? (a) blue (b) magenta (c) bright green (d) cyan
-
12.⚖️ What colour is the text of this element?
<h1 class="box" id="logo">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: red; } (a) green (b) orange (c) red (d) white -
13.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} -
14.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 15.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
- 16.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
- 17.True or false: JavaScript checks a quiz answer. (a) True (b) False
- 18.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
- 19.True or false: margin is space outside the border. (a) True (b) False
-
20.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 12px;
}
} - 21.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the end (c) puts boxes in the middle (d) packs boxes at the start
-
22.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 23.True or false: CSS rounds box corners. (a) True (b) False
- 24.True or false: padding is the gap round content. (a) False (b) True
- 25.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
- 26.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
-
27.✍️ What is the selector in this CSS rule?
li {
margin: 10px;
background-color: yellow;
} (a) body (b) yellow (c) li (d) margin -
28.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
.box { color: white; }
#hero { color: red; }
p { color: yellow; } (a) white (b) blue (c) yellow (d) red -
29.⚖️ What colour is the text of this element?
<h1 class="big" id="main">Hi</h1>
CSS:
.big { color: red; }
.big { color: purple; } (a) purple (b) green (c) red (d) black - 30.Which of these does HTML do? (a) makes a form box (b) shows a pop-up message (c) adds space around boxes (d) rounds box corners
-
31.🖌️ What colour is behind the letters?
li {
color: white;
text-align: left;
background-color: black;
font-size: 36px;
} (a) blue (b) black (c) white -
32.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
33.⚖️ What colour is the text of this element?
<p class="note" id="logo">Hi</p>
CSS:
p { color: yellow; }
#logo { color: purple; }
.note { color: blue; } (a) black (b) blue (c) purple (d) yellow -
34.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: purple; } (a) orange (b) purple (c) yellow (d) white -
35.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} -
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 2px solid black;
margin: 20px;
} - 37.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
- 38.What does font-weight do? (a) picks the font style (b) makes the text bold (c) centres a heading (d) sets the letter colour
-
39.✍️ What value is given to font-style in this rule?
body {
font-style: italic;
border: 2px solid;
width: 300px;
} (a) 20px (b) italic (c) font-style (d) red -
40.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
text-align: center;
}
Answer key
- space-between
- 234
- 4
- 800px or wider
- center
- green
- #logo
- 20
- margin
- #
- cyan
- red
- 22
- Yes
- a class selector
- blue
- True
- .
- True
- 12
- equal gaps, none at ends
- 234
- True
- True
- padding
- the later one
- li
- red
- purple
- makes a form box
- black
- Yes
- purple
- purple
- 244
- 114
- 137
- makes the text bold
- italic
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids