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 makes a link? (a) JavaScript (b) HTML (c) CSS
- 2.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
-
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} -
4.💪 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). -
5.🖌️ What colour are the letters?
h2 {
color: white;
text-align: right;
font-size: 20px;
background-color: orange;
} (a) red (b) orange (c) white - 6.Which of these does HTML do? (a) lays out the page (b) sets colours and fonts (c) shows a pop-up message (d) puts a picture on a page
-
7.✍️ What value is given to text-align in this rule?
h1 {
font-style: italic;
padding: 8px;
text-align: center;
} (a) 10px (b) center (c) text-align (d) yellow -
8.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
.note { color: red; }
#end { color: orange; } (a) yellow (b) blue (c) orange (d) red - 9.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red
- 10.What does font-family do? (a) makes the text bold (b) picks the font style (c) centres a heading (d) colours behind the text
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
12.✍️ Which property is set to 8px in this rule?
.note {
font-size: 20px;
padding: 8px;
margin: 10px;
width: 300px;
} (a) 8px (b) border (c) padding (d) font-weight -
13.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
.box { color: green; }
.box { color: orange; } (a) yellow (b) orange (c) blue (d) green - 14.True or false: the border is the line round the box. (a) False (b) True
- 15.🖌️ Which CSS property centres a heading? (a) font-weight (b) font-family (c) text-align (d) font-size
- 16.✍️ Which sign ends each CSS declaration? (a) ; (b) : (c) , (d) .
-
17.✍️ What value is given to background-color in this rule?
p {
background-color: yellow;
font-weight: bold;
} (a) background-color (b) 10px (c) 8px (d) yellow - 18.Which of these does JavaScript do? (a) shows a pop-up message (b) makes a link (c) makes headings and lists (d) puts a picture on a page
-
19.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
p { color: black; }
p { color: orange; } (a) black (b) red (c) green (d) orange -
20.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 4 boxes, each 50px wide (no margins). -
21.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
.big { color: black; }
.big { color: yellow; } (a) purple (b) black (c) yellow (d) red - 22.🎨 Which tag holds CSS inside the head? (a) <css> (b) <body> (c) <script> (d) <style>
-
23.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} - 24.🌈 In #000056 the blue part is the hex number 56. What is it as a normal number?
-
25.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
26.⚖️ What colour is the text of this element?
<h1 class="box" id="logo">Hi</h1>
CSS:
.box { color: blue; }
.box { color: orange; } (a) blue (b) white (c) orange (d) green -
27.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
28.✍️ What is the selector in this CSS rule?
#top {
margin: 10px;
font-size: 20px;
text-align: center;
padding: 8px;
} (a) 20px (b) #top (c) margin (d) li -
29.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 30.🌈 Which hex code is blue? (a) #00ffff (b) #ff00ff (c) #0000ff (d) #00ff00
- 31.🌈 Which hex code is black? (a) #00ff00 (b) #ffffff (c) #000000 (d) #00ffff
- 32.True or false: margin is space inside the border. (a) True (b) False
- 33.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) gives the page structure (d) counts down a timer
- 34.🔍 Which is the odd one out? (a) counts down a timer (b) lays out the page (c) shows a pop-up message (d) checks a quiz answer
-
35.🖌️ What colour are the letters?
h1 {
font-size: 28px;
color: purple;
background-color: black;
text-align: left;
} (a) black (b) purple (c) blue -
36.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). - 37.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
-
38.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). - 39.What does background-color do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) sets the letter colour
- 40.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
Answer key
- HTML
- CSS
- 160
- 60
- white
- puts a picture on a page
- center
- orange
- blue
- picks the font style
- 184
- padding
- orange
- True
- text-align
- ;
- yellow
- shows a pop-up message
- orange
- 80
- yellow
- <style>
- 14
- 86
- Yes
- orange
- No
- #top
- Yes
- #0000ff
- #000000
- False
- counts down a timer
- lays out the page
- purple
- 20
- HTML
- 30
- colours behind the text
- flex-direction
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids