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 of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the gap round content
-
2.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
margin: 10px;
} -
3.✍️ What value is given to padding in this rule?
#top {
font-weight: bold;
padding: 8px;
} (a) 2px solid (b) 8px (c) padding (d) bold -
4.🎯 Which CSS selector matches this element?
<div class="big" id="main">Hello</div> (a) div (b) #logo (c) .red (d) span - 5.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
- 6.True or false: JavaScript shows a pop-up message. (a) False (b) True
- 7.🌈 In #009e00 the green part is the hex number 9e. What is it as a normal number?
-
8.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-size: 20px;
padding: 8px;
border: 2px solid;
} -
9.🎯 Which CSS selector matches this element?
<li class="menu" id="top">Hello</li> (a) .note (b) .top (c) li (d) div -
10.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 170px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 11.🖌️ Which CSS property makes letters bigger? (a) color (b) font-weight (c) text-align (d) font-size
-
12.🎯 Which CSS selector matches this element?
<div class="big" id="top">Hello</div> (a) #big (b) span (c) #top (d) #intro -
13.✍️ Which property is set to 10px in this rule?
.box {
text-align: center;
margin: 10px;
font-style: italic;
font-weight: bold;
} (a) font-weight (b) padding (c) 10px (d) margin -
14.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
.menu { color: green; }
.menu { color: yellow; } (a) yellow (b) purple (c) green (d) black - 15.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the br tag (d) the hr tag
-
16.✍️ What is the selector in this CSS rule?
h2 {
color: red;
background-color: yellow;
} (a) h2 (b) color (c) yellow (d) h1 - 17.🌈 Which hex code is white? (a) #ffffff (b) #ff00ff (c) #000000 (d) #0000ff
- 18.🔍 Which is the odd one out? (a) makes a form box (b) rounds box corners (c) lays out the page (d) changes the text size
- 19.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) center (d) flex-start
- 20.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
-
21.✍️ Which property is set to 300px in this rule?
body {
width: 300px;
font-weight: bold;
border: 2px solid;
color: red;
} (a) color (b) 300px (c) font-style (d) width -
22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 12px;
}
} - 23.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
- 24.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
- 25.🌈 Which hex code is bright green? (a) #00ffff (b) #0000ff (c) #00ff00 (d) #ffffff
- 26.Which of these does CSS do? (a) shows a pop-up message (b) counts down a timer (c) makes a form box (d) rounds box corners
-
27.🖌️ How big is the text, in px?
h2 {
color: white;
background-color: purple;
text-align: right;
font-size: 12px;
} -
28.✍️ What is the selector in this CSS rule?
body {
padding: 8px;
font-size: 20px;
} (a) body (b) 20px (c) .box (d) padding -
29.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) Yes (b) No -
30.🖌️ How big is the text, in px?
h2 {
background-color: blue;
color: black;
text-align: right;
font-size: 40px;
} -
31.🎯 Which CSS selector matches this element?
<p class="box" id="top">Hello</p> (a) #intro (b) .box (c) #box (d) h1 - 32.🌈 Which colour of light is strongest in rgb(165, 7, 102)? (a) green (b) red (c) blue
- 33.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
-
34.⚖️ What colour is the text of this element?
<h1 class="box" id="logo">Hi</h1>
CSS:
#logo { color: green; }
h1 { color: blue; }
.box { color: yellow; } (a) blue (b) black (c) yellow (d) green -
35.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-size: 20px;
} - 36.What does text-align do? (a) colours behind the text (b) makes letters bigger (c) makes the text bold (d) centres a heading
- 37.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
- 38.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) adds space around boxes (d) makes a link
-
39.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 40.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the text size (c) checks a quiz answer (d) counts down a timer
Answer key
- the gap round content
- 2
- 8px
- div
- 3
- True
- 158
- 3
- li
- 70
- font-size
- #top
- margin
- yellow
- the viewport meta tag
- h2
- #ffffff
- makes a form box
- flex-end
- space-between
- width
- 16
- 800px or wider
- packs boxes at the start
- #00ff00
- rounds box corners
- 12
- body
- Yes
- 40
- .box
- red
- :
- green
- 1
- centres a heading
- puts boxes in the middle
- adds space around boxes
- Yes
- changes the text size
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids