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.What does text-align do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) centres a heading
-
2.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). - 3.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
- 4.🌈 Which colour is rgb(255, 255, 0)? (a) bright green (b) blue (c) cyan (d) yellow
- 5.True or false: JavaScript adds space around boxes. (a) True (b) False
- 6.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) color (d) :
- 7.🔍 Which is the odd one out? (a) sets colours and fonts (b) reacts to a button click (c) adds space around boxes (d) lays out the page
- 8.True or false: p is a class selector. (a) False (b) True
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} - 10.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) magenta (c) blue (d) bright green
-
11.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 16px;
}
} -
12.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
.menu { color: black; }
#end { color: blue; } (a) red (b) green (c) blue (d) black - 13.🌈 In #00f500 the green part is the hex number f5. What is it as a normal number?
-
14.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} (a) Yes (b) No -
15.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
p { color: purple; }
.box { color: green; } (a) purple (b) white (c) green (d) yellow -
16.🎯 Which CSS selector matches this element?
<p class="star" id="end">Hello</p> (a) #hero (b) p (c) h1 (d) #star - 17.True or false: HTML makes a form box. (a) True (b) False
-
18.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 19.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
- 20.🌈 Which colour is #ff0000? (a) magenta (b) white (c) yellow (d) red
-
21.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
.box { color: yellow; }
.box { color: blue; } (a) purple (b) blue (c) red (d) yellow - 22.🔍 Which is the odd one out? (a) counts down a timer (b) changes the page live (c) shows a pop-up message (d) adds space around boxes
- 23.Which of these does CSS do? (a) puts a picture on a page (b) sets colours and fonts (c) checks a quiz answer (d) shows a pop-up message
- 24.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
- 25.🧩 Which language makes a form box? (a) HTML (b) JavaScript (c) CSS
-
26.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
27.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} (a) No (b) Yes - 28.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
-
29.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} (a) Yes (b) No - 30.Which of these is the content? (a) space inside the border (b) a solid or dotted edge (c) the text or picture (d) the line round the box
- 31.🎯 Can many elements share the same class? (a) No (b) Yes
- 32.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
- 33.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) flex-end (d) space-between
-
34.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
#intro { color: red; }
p { color: yellow; }
.box { color: purple; } (a) black (b) red (c) yellow (d) purple - 35.🌈 In #00e900 the green part is the hex number e9. What is it as a normal number?
-
36.✍️ What is the selector in this CSS rule?
h2 {
padding: 8px;
width: 300px;
margin: 10px;
background-color: yellow;
} (a) h1 (b) h2 (c) padding (d) 300px - 37.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
-
38.✍️ What is the selector in this CSS rule?
#top {
margin: 10px;
color: red;
} (a) li (b) margin (c) red (d) #top -
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 30px;
border: 1px solid black;
margin: 5px;
} - 40.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
Answer key
- centres a heading
- 60
- HTML
- yellow
- False
- color
- reacts to a button click
- False
- 328
- bright green
- 20
- blue
- 245
- Yes
- green
- p
- True
- 90
- center
- red
- blue
- adds space around boxes
- sets colours and fonts
- /*
- HTML
- Yes
- Yes
- .css
- Yes
- the text or picture
- Yes
- puts boxes in the middle
- flex-start
- red
- 233
- h2
- { }
- #top
- 182
- 600px or narrower
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids