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 puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
- 2.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 3.💪 Which flexbox property turns on flexbox? (a) align-items (b) flex-direction (c) gap (d) display: flex
-
4.✍️ What value is given to width in this rule?
.note {
margin: 10px;
background-color: yellow;
width: 300px;
} (a) red (b) width (c) italic (d) 300px -
5.🖌️ What colour are the letters?
h1 {
text-align: right;
background-color: white;
color: yellow;
font-size: 24px;
} (a) purple (b) yellow (c) white -
6.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 32px;
}
} (a) Yes (b) No -
7.🖌️ What colour are the letters?
h1 {
font-size: 40px;
color: white;
background-color: yellow;
text-align: right;
} (a) red (b) yellow (c) white - 8.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 6 (d) 4
- 9.💪 Which flexbox property lines boxes up across? (a) align-items (b) flex-direction (c) gap (d) display: flex
- 10.✍️ In color: blue; which part is the value? (a) color (b) blue (c) : (d) ;
- 11.🌈 Which hex code is yellow? (a) #000000 (b) #00ffff (c) #ffff00 (d) #ff00ff
-
12.⚖️ What colour is the text of this element?
<h1 class="big" id="main">Hi</h1>
CSS:
.big { color: red; }
h1 { color: white; } (a) yellow (b) white (c) green (d) red - 13.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
- 14.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) black (c) bright green (d) yellow
- 15.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
-
16.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). -
17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} - 18.🖌️ Which CSS property sets the letter colour? (a) font-family (b) color (c) text-align (d) font-size
-
19.✍️ What value is given to color in this rule?
h1 {
margin: 10px;
color: red;
} (a) color (b) red (c) 20px (d) center - 20.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) , (d) ;
-
21.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} -
22.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
23.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
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: 50px;
padding: 15px;
border: 3px solid black;
margin: 15px;
} - 25.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
- 26.🌈 Which colour of light is strongest in rgb(64, 168, 117)? (a) red (b) blue (c) green
- 27.🌈 Which colour of light is strongest in rgb(131, 129, 203)? (a) red (b) green (c) blue
-
28.🎯 Which CSS selector matches this element?
<li class="red" id="main">Hello</li> (a) .box (b) div (c) #red (d) .red -
29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 20px;
border: 5px solid black;
margin: 5px;
} - 30.🌈 Which hex code is blue? (a) #0000ff (b) #ff00ff (c) #ff0000 (d) #00ffff
- 31.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
-
32.🖌️ How big is the text, in px?
h1 {
color: blue;
font-size: 12px;
background-color: black;
text-align: left;
} - 33.True or false: margin is space inside the border. (a) True (b) False
- 34.🌈 Which colour of light is strongest in rgb(75, 227, 72)? (a) red (b) blue (c) green
- 35.What does font-family do? (a) centres a heading (b) colours behind the text (c) picks the font style (d) sets the letter colour
- 36.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
-
37.✍️ What is the selector in this CSS rule?
h2 {
border: 2px solid;
margin: 10px;
font-weight: bold;
} (a) 10px (b) border (c) h1 (d) h2 - 38.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-family (c) background-color (d) font-weight
-
39.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 40.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
Answer key
- center
- :
- display: flex
- 300px
- yellow
- Yes
- white
- 3
- align-items
- blue
- #ffff00
- red
- a class selector
- bright green
- a class selector
- 30
- 20
- color
- red
- ;
- 22
- No
- Yes
- 86
- HTML
- green
- blue
- .red
- 120
- #0000ff
- space-between
- 12
- False
- green
- picks the font style
- /*
- h2
- background-color
- Yes
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids