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.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) content (d) margin
-
2.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
#logo { color: black; }
p { color: blue; } (a) blue (b) black (c) green (d) white -
3.✍️ What value is given to font-size in this rule?
h1 {
font-size: 20px;
font-style: italic;
} (a) center (b) 20px (c) font-size (d) yellow - 4.What does font-family do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) makes the text bold
- 5.What does justify-content: flex-end 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
-
6.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
.note { color: green; }
h1 { color: red; }
#hero { color: yellow; } (a) green (b) white (c) yellow (d) red - 7.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) content (d) padding
-
8.🖌️ How big is the text, in px?
p {
text-align: center;
background-color: orange;
font-size: 40px;
color: black;
} -
9.🎯 Which CSS selector matches this element?
<li class="note" id="hero">Hello</li> (a) .big (b) #hero (c) div (d) #note - 10.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
-
11.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
h2 { color: blue; }
#logo { color: orange; }
.star { color: black; } (a) orange (b) purple (c) blue (d) black -
12.✍️ How many declarations (property: value pairs) are in this rule?
li {
text-align: center;
width: 300px;
font-size: 20px;
border: 2px solid;
} - 13.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
- 14.🌈 Which hex code is yellow? (a) #ffff00 (b) #000000 (c) #0000ff (d) #ff00ff
- 15.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) < > (d) { }
- 16.True or false: padding is space inside the border. (a) True (b) False
- 17.True or false: margin is space outside the border. (a) False (b) True
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} - 19.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-end (d) flex-start
- 20.📱 What does a media query check? (a) the screen width (b) the time of day (c) the battery level (d) the page title
-
21.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
22.✍️ Which property is set to 8px in this rule?
.note {
width: 300px;
font-size: 20px;
background-color: yellow;
padding: 8px;
} (a) border (b) padding (c) font-weight (d) 8px -
23.🎯 Which CSS selector matches this element?
<p class="box" id="hero">Hello</p> (a) h1 (b) .star (c) .box (d) #top - 24.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) exactly 100px (d) 800px or narrower
-
25.✍️ What value is given to color in this rule?
p {
font-weight: bold;
padding: 8px;
color: red;
} (a) 20px (b) center (c) color (d) red - 26.True or false: img is an element selector. (a) False (b) True
- 27.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the text size (c) counts down a timer (d) adds space around boxes
-
28.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} - 29.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) text-align (d) font-weight
-
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 5px;
border: 1px solid black;
margin: 0px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} - 32.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) gap (c) display: flex (d) justify-content
-
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 340px;
justify-content: space-between;
}
Inside are 3 boxes, each 80px wide (no margins). -
34.✍️ How many declarations (property: value pairs) are in this rule?
li {
padding: 8px;
} -
35.🎯 Which CSS selector matches this element?
<p class="box" id="end">Hello</p> (a) #box (b) .box (c) #hero (d) .end - 36.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
- 37.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) center (d) flex-start
-
38.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
.box { color: orange; }
#main { color: purple; } (a) black (b) purple (c) orange (d) white -
39.🖌️ How big is the text, in px?
h1 {
font-size: 16px;
background-color: white;
text-align: center;
color: orange;
} - 40.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
Answer key
- padding
- black
- 20px
- picks the font style
- packs boxes at the end
- yellow
- content
- 40
- #hero
- <link>
- orange
- 4
- packs boxes at the start
- #ffff00
- { }
- True
- True
- 142
- flex-start
- the screen width
- Yes
- padding
- .box
- 800px or wider
- red
- True
- counts down a timer
- 28
- color
- 202
- 272
- display: flex
- 50
- 1
- .box
- equal gaps, none at ends
- center
- purple
- 16
- ;
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids