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.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) margin (d) content
-
2.⚖️ What colour is the text of this element?
<h2 class="red" id="end">Hi</h2>
CSS:
#end { color: white; }
#end { color: red; } (a) orange (b) white (c) red (d) green -
3.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 420px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). -
4.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) No (b) Yes -
5.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 6.🌈 Which colour of light is strongest in rgb(23, 185, 70)? (a) blue (b) green (c) red
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 130px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 8.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
-
9.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 15px;
border: 4px solid black;
margin: 0px;
} - 10.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
- 11.What does text-align do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) makes letters bigger
- 12.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) no pages (d) only one word
-
13.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 14.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) color (d) font-family
- 15.🎯 What kind of selector is li? (a) an id selector (b) an element selector (c) a class selector
- 16.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
-
17.🖌️ How big is the text, in px?
p {
background-color: blue;
color: white;
text-align: left;
font-size: 12px;
} - 18.Which of these does CSS do? (a) checks a quiz answer (b) counts down a timer (c) lays out the page (d) gives the page structure
-
19.✍️ How many declarations (property: value pairs) are in this rule?
li {
text-align: center;
color: red;
} - 20.Which of these is the content? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) the gap round content
- 21.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 22.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-family (d) font-size
- 23.🌈 In #f40000 the red part is the hex number f4. What is it as a normal number?
- 24.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
-
25.🖌️ What colour is behind the letters?
li {
font-size: 36px;
background-color: orange;
color: blue;
text-align: right;
} (a) orange (b) blue (c) red - 26.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h1 class="note"> (c) <h1 class="big"> (d) <h2 class="red">
- 27.🎯 Can many elements share the same class? (a) No (b) Yes
-
28.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 350px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
29.✍️ How many declarations (property: value pairs) are in this rule?
body {
border: 2px solid;
padding: 8px;
color: red;
} - 30.💪 Which flexbox property picks row or column? (a) justify-content (b) gap (c) flex-direction (d) display: flex
- 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
- 32.🔍 Which is the odd one out? (a) counts down a timer (b) rounds box corners (c) sets colours and fonts (d) lays out the page
- 33.🎯 Which element does the selector h2 style? (a) <li> (b) <span id="logo"> (c) <div class="big"> (d) <h2 class="big">
- 34.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
-
35.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
#logo { color: yellow; }
.big { color: blue; } (a) orange (b) blue (c) yellow (d) green -
36.✍️ Which property is set to bold in this rule?
li {
font-weight: bold;
color: red;
} (a) bold (b) width (c) border (d) font-weight - 37.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
-
38.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 39.What does color do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) picks the font style
- 40.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) the gap to other boxes (d) the gap round content
Answer key
- margin
- red
- 60
- No
- Yes
- green
- 10
- sets colours and fonts
- 138
- padding
- centres a heading
- many pages
- 10
- font-family
- an element selector
- JavaScript
- 12
- lays out the page
- 2
- the text or picture
- an element selector
- font-size
- 244
- space-between
- orange
- <h1 class="note">
- Yes
- 10
- 3
- flex-direction
- flex-start
- counts down a timer
- <h2 class="big">
- flex-end
- yellow
- font-weight
- /*
- Yes
- sets the letter colour
- the gap to other boxes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids