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: CSS changes the page live. (a) True (b) False
- 2.⚖️ 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
- 3.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
- 4.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) yellow (c) cyan (d) bright green
-
5.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 560px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). - 6.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-end (d) flex-start
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 480px;
justify-content: flex-end;
}
Inside are 4 boxes, each 100px wide (no margins). - 8.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
-
9.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 440px;
justify-content: space-between;
}
Inside are 4 boxes, each 50px wide (no margins). -
10.🎯 Which CSS selector matches this element?
<div class="star" id="top">Hello</div> (a) .menu (b) .star (c) .top (d) #star -
11.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} - 12.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) changes the page live (d) adds space around boxes
-
13.⚖️ What colour is the text of this element?
<h1 class="red" id="intro">Hi</h1>
CSS:
.red { color: white; }
.red { color: orange; } (a) orange (b) blue (c) white (d) yellow - 14.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
- 15.True or false: padding is space inside the border. (a) False (b) True
-
16.🎯 Which CSS selector matches this element?
<h1 class="red" id="top">Hello</h1> (a) #intro (b) .box (c) h1 (d) h2 -
17.✍️ What value is given to border in this rule?
#top {
font-size: 20px;
border: 2px solid;
font-weight: bold;
} (a) 2px solid (b) 300px (c) italic (d) border -
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 440px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). - 19.🌈 Which hex code is magenta? (a) #0000ff (b) #ffffff (c) #ff00ff (d) #00ffff
-
20.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
21.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
font-style: italic;
} -
22.🎯 Which CSS selector matches this element?
<span class="box" id="intro">Hello</span> (a) p (b) #intro (c) #box (d) .intro - 23.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
- 24.💪 Which flexbox property sets space between boxes? (a) justify-content (b) gap (c) align-items (d) display: flex
-
25.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} -
26.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 200px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). - 27.🔍 Which is the odd one out? (a) makes a link (b) changes the page live (c) makes a form box (d) makes headings and lists
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
29.🖌️ What colour are the letters?
p {
color: white;
font-size: 40px;
text-align: left;
background-color: red;
} (a) red (b) white (c) purple - 30.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
- 31.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
-
32.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-weight: bold;
width: 300px;
margin: 10px;
} - 33.True or false: CSS makes a form box. (a) True (b) False
-
34.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) No (b) Yes - 35.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
- 36.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
- 37.Which of these does HTML do? (a) lays out the page (b) makes a link (c) sets colours and fonts (d) changes the page live
-
38.🖌️ Where does the text sit on its line?
li {
background-color: green;
font-size: 28px;
color: orange;
text-align: right;
} (a) on the left (b) on the right (c) in the middle -
39.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
.big { color: purple; }
h2 { color: black; }
#top { color: yellow; } (a) purple (b) black (c) yellow (d) orange - 40.🌈 Which colour is #00ffff? (a) bright green (b) black (c) magenta (d) cyan
Answer key
- False
- the later one
- :
- bright green
- 80
- flex-end
- 80
- CSS
- 80
- .star
- 16
- adds space around boxes
- orange
- #
- True
- h1
- 2px solid
- 60
- #ff00ff
- Yes
- 2
- #intro
- blue
- gap
- 26
- 80
- changes the page live
- 136
- white
- space-between
- 600px or narrower
- 3
- False
- No
- 800px or wider
- an id selector
- makes a link
- on the right
- yellow
- cyan
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids