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 colour is rgb(255, 255, 0)? (a) red (b) yellow (c) blue (d) magenta
- 2.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
-
3.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
4.✍️ What is the selector in this CSS rule?
p {
border: 2px solid;
width: 300px;
} (a) 300px (b) border (c) .note (d) p -
5.✍️ What is the selector in this CSS rule?
.note {
width: 300px;
margin: 10px;
padding: 8px;
background-color: yellow;
} (a) #top (b) .note (c) width (d) 10px -
6.🖌️ What colour are the letters?
p {
background-color: purple;
color: green;
font-size: 16px;
text-align: right;
} (a) green (b) purple (c) white - 7.Which of these is the content? (a) the line round the box (b) space inside the border (c) a solid or dotted edge (d) the text or picture
- 8.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
- 9.💪 Which flexbox property turns on flexbox? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
- 10.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
- 11.What does background-color do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) makes letters bigger
-
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 2 boxes, each 100px wide (no margins). -
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} - 14.True or false: CSS adds space around boxes. (a) True (b) False
- 15.True or false: padding is the gap to other boxes. (a) True (b) False
-
16.⚖️ What colour is the text of this element?
<h1 class="star" id="end">Hi</h1>
CSS:
h1 { color: green; }
.star { color: white; }
#end { color: purple; } (a) green (b) orange (c) purple (d) white - 17.🌈 Which colour is #00ff00? (a) cyan (b) white (c) bright green (d) red
-
18.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
.note { color: blue; }
.note { color: green; } (a) white (b) blue (c) green (d) red -
19.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). - 20.Which of these does CSS do? (a) changes the page live (b) makes headings and lists (c) puts a picture on a page (d) rounds box corners
-
21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 30px;
border: 4px solid black;
margin: 10px;
} - 22.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) gap (c) display: flex (d) justify-content
- 23.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
-
24.✍️ Which property is set to italic in this rule?
h1 {
margin: 10px;
padding: 8px;
font-style: italic;
} (a) color (b) italic (c) font-size (d) font-style -
25.⚖️ What colour is the text of this element?
<p class="note" id="end">Hi</p>
CSS:
p { color: red; }
p { color: green; } (a) red (b) blue (c) orange (d) green -
26.🎯 Which CSS selector matches this element?
<span class="star" id="logo">Hello</span> (a) .menu (b) #end (c) .star (d) #star - 27.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
- 28.🌈 Which hex code is bright green? (a) #00ff00 (b) #ff0000 (c) #00ffff (d) #0000ff
-
29.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 140px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 30.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
- 31.True or false: the border is the line round the box. (a) False (b) True
-
32.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
#logo { color: purple; }
#logo { color: yellow; } (a) black (b) purple (c) blue (d) yellow - 33.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
-
34.🎯 Which CSS selector matches this element?
<li class="star" id="main">Hello</li> (a) div (b) .menu (c) li (d) #logo -
35.✍️ Which property is set to red in this rule?
h2 {
color: red;
border: 2px solid;
} (a) font-size (b) red (c) text-align (d) color -
36.🎯 Which CSS selector matches this element?
<span class="star" id="intro">Hello</span> (a) p (b) #main (c) #intro (d) .intro - 37.True or false: CSS checks a quiz answer. (a) False (b) True
- 38.🎯 What kind of selector is .card? (a) a class selector (b) an id selector (c) an element selector
-
39.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 16px;
}
} (a) No (b) Yes - 40.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
Answer key
- yellow
- margin
- 20
- p
- .note
- green
- the text or picture
- F
- display: flex
- fits every screen
- colours behind the text
- 80
- 278
- True
- False
- purple
- bright green
- green
- 60
- rounds box corners
- 218
- gap
- JavaScript
- font-style
- green
- .star
- :
- #00ff00
- 40
- color
- True
- yellow
- the viewport meta tag
- li
- color
- #intro
- False
- a class selector
- No
- .
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids