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 colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
#main { color: blue; }
#main { color: black; } (a) green (b) black (c) blue (d) purple - 2.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
- 3.🌈 Which colour is #ff0000? (a) magenta (b) white (c) red (d) blue
- 4.🧩 Which language changes the page live? (a) HTML (b) JavaScript (c) CSS
- 5.Which of these does HTML do? (a) adds space around boxes (b) rounds box corners (c) makes a form box (d) sets colours and fonts
- 6.True or false: .note is a class selector. (a) True (b) False
- 7.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) many pages (d) no pages
- 8.🔍 Which is the odd one out? (a) counts down a timer (b) changes the text size (c) lays out the page (d) rounds box corners
-
9.⚖️ What colour is the text of this element?
<p class="red" id="main">Hi</p>
CSS:
#main { color: blue; }
#main { color: black; } (a) black (b) blue (c) green (d) white - 10.🧩 Which language changes the text size? (a) HTML (b) CSS (c) JavaScript
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} - 12.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) exactly 100px (d) turned off
-
13.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
p { color: black; }
p { color: green; } (a) green (b) orange (c) blue (d) black -
14.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
h1 { color: yellow; }
.note { color: purple; } (a) purple (b) white (c) yellow (d) black - 15.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
- 16.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 5 (d) 2
- 17.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) : (d) color
- 18.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) space-between (d) flex-start
-
19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 280px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
20.✍️ Which property is set to yellow in this rule?
h1 {
padding: 8px;
background-color: yellow;
} (a) padding (b) margin (c) background-color (d) yellow -
21.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 30px;
border: 4px solid black;
margin: 15px;
} - 22.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
- 23.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) space-between (d) center
- 24.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) changes the page live
-
25.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
26.✍️ What is the selector in this CSS rule?
#top {
padding: 8px;
background-color: yellow;
font-style: italic;
} (a) padding (b) yellow (c) li (d) #top - 27.True or false: padding is the text or picture. (a) True (b) False
- 28.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
-
29.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 30.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
- 31.🎯 Which element does the selector h2 style? (a) <span id="logo"> (b) <h2 class="note"> (c) <div class="note"> (d) <li>
- 32.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
33.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
#logo { color: red; }
#logo { color: white; } (a) yellow (b) purple (c) white (d) red -
34.✍️ How many declarations (property: value pairs) are in this rule?
p {
color: red;
background-color: yellow;
} - 35.True or false: HTML adds space around boxes. (a) False (b) True
-
36.📦 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: 10px;
border: 1px solid black;
margin: 10px;
} -
37.✍️ How many declarations (property: value pairs) are in this rule?
body {
width: 300px;
} -
38.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 39.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
-
40.✍️ Which property is set to 8px in this rule?
.note {
color: red;
padding: 8px;
border: 2px solid;
} (a) font-weight (b) 8px (c) border (d) padding
Answer key
- black
- blue
- red
- JavaScript
- makes a form box
- True
- many pages
- counts down a timer
- black
- CSS
- 228
- 800px or wider
- green
- purple
- JavaScript
- 1
- color
- flex-start
- 304
- background-color
- 238
- F
- space-between
- changes the page live
- No
- #top
- False
- a class selector
- No
- packs boxes at the start
- <h2 class="note">
- an element selector
- white
- 2
- False
- 72
- 1
- Yes
- { }
- padding
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids