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 language gives the page structure? (a) JavaScript (b) CSS (c) HTML
- 2.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
- 3.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
- 4.🌈 In #009900 the green part is the hex number 99. What is it as a normal number?
-
5.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} -
6.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} -
7.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
8.✍️ What is the selector in this CSS rule?
li {
background-color: yellow;
border: 2px solid;
} (a) background-color (b) 2px solid (c) body (d) li -
9.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). -
10.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No -
11.🖌️ How big is the text, in px?
li {
color: white;
font-size: 32px;
text-align: center;
background-color: blue;
} - 12.🔍 Which is the odd one out? (a) rounds box corners (b) shows a pop-up message (c) changes the page live (d) checks a quiz answer
-
13.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} - 14.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
- 15.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <css> (d) <script>
-
16.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 17.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
18.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
.star { color: black; }
.star { color: blue; } (a) blue (b) white (c) orange (d) black - 19.💪 Which flexbox property sets space between boxes? (a) align-items (b) flex-direction (c) display: flex (d) gap
- 20.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) counts down a timer (d) checks a quiz answer
-
21.✍️ Which property is set to 2px solid in this rule?
body {
text-align: center;
margin: 10px;
padding: 8px;
border: 2px solid;
} (a) 2px solid (b) width (c) border (d) font-style - 22.What does font-size do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) sets the letter colour
-
23.🖌️ What colour are the letters?
h1 {
font-size: 16px;
color: white;
background-color: black;
text-align: right;
} (a) black (b) yellow (c) white - 24.🌈 Which colour of light is strongest in rgb(129, 7, 150)? (a) green (b) blue (c) red
-
25.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
.big { color: blue; }
.big { color: purple; } (a) black (b) purple (c) blue (d) red - 26.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) text-align (d) color
-
27.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} - 28.Which of these does JavaScript do? (a) lays out the page (b) rounds box corners (c) reacts to a button click (d) makes a form box
- 29.True or false: the border is the text or picture. (a) False (b) True
-
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} - 31.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
- 32.🎯 Which sign starts an id selector? (a) & (b) . (c) # (d) @
- 33.What does font-weight do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) sets the letter colour
- 34.True or false: padding is the line round the box. (a) False (b) True
-
35.✍️ What is the selector in this CSS rule?
.box {
padding: 8px;
margin: 10px;
} (a) .box (b) 10px (c) h2 (d) padding - 36.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
-
37.🎯 Which CSS selector matches this element?
<li class="big" id="top">Hello</li> (a) div (b) .red (c) .big (d) .top - 38.True or false: CSS adds space around boxes. (a) False (b) True
-
39.⚖️ What colour is the text of this element?
<h2 class="star" id="hero">Hi</h2>
CSS:
h2 { color: black; }
h2 { color: orange; } (a) black (b) white (c) orange (d) yellow -
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 250px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins).
Answer key
- HTML
- HTML
- Cascading Style Sheets
- 153
- 150
- 24
- No
- li
- 40
- No
- 32
- rounds box corners
- 152
- packs boxes at the end
- <style>
- No
- an id selector
- blue
- gap
- makes headings and lists
- border
- makes letters bigger
- white
- blue
- purple
- font-weight
- 10
- reacts to a button click
- False
- 140
- HTML
- #
- makes the text bold
- False
- .box
- an element selector
- .big
- True
- orange
- 50
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids