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 font-family do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) colours behind the text
- 2.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) puts a picture on a page (d) sets colours and fonts
-
3.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 20px;
}
} - 4.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 255 (d) 100
- 5.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
- 6.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
7.✍️ What value is given to border in this rule?
h2 {
color: red;
border: 2px solid;
} (a) 2px solid (b) italic (c) border (d) 300px -
8.🎯 Which CSS selector matches this element?
<h2 class="red" id="main">Hello</h2> (a) li (b) .box (c) #red (d) .red - 9.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
- 10.True or false: the content is the text or picture. (a) True (b) False
-
11.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 12.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
- 13.True or false: #hero is an id selector. (a) True (b) False
-
14.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
15.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
.menu { color: white; }
p { color: red; } (a) black (b) yellow (c) red (d) white - 16.🌈 Which colour is #ff00ff? (a) red (b) white (c) black (d) magenta
- 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
- 18.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) border (d) margin
-
19.✍️ How many declarations (property: value pairs) are in this rule?
.box {
color: red;
font-size: 20px;
font-weight: bold;
} -
20.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 170px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). -
21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 60px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} - 22.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) checks a quiz answer (d) makes headings and lists
-
23.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} (a) No (b) Yes - 24.🎯 Which element does the selector li style? (a) <li class="star"> (b) <p id="top"> (c) <span class="star"> (d) <div>
- 25.What does background-color do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) centres a heading
-
26.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 380px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). - 27.True or false: HTML changes the text size. (a) True (b) False
- 28.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
-
29.🎯 Which CSS selector matches this element?
<span class="note" id="end">Hello</span> (a) #note (b) #hero (c) .end (d) #end -
30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 16px;
}
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
32.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). - 33.Which of these is padding? (a) the line round the box (b) a solid or dotted edge (c) space inside the border (d) the text or picture
-
34.📦 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: 30px;
border: 3px solid black;
margin: 5px;
} - 35.True or false: HTML makes a link. (a) False (b) True
-
36.🖌️ What colour is behind the letters?
p {
background-color: purple;
color: orange;
text-align: center;
font-size: 28px;
} (a) white (b) orange (c) purple -
37.🖌️ What colour are the letters?
h2 {
background-color: white;
text-align: left;
font-size: 12px;
color: green;
} (a) blue (b) white (c) green - 38.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) puts a picture on a page (d) shows a pop-up message
-
39.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 560px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
40.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} (a) No (b) Yes
Answer key
- picks the font style
- sets colours and fonts
- 24
- 255
- content
- an id selector
- 2px solid
- .red
- { }
- True
- 80
- <link>
- True
- No
- white
- magenta
- the later one
- border
- 3
- 50
- 84
- makes headings and lists
- No
- <li class="star">
- colours behind the text
- 60
- False
- <style>
- #end
- 16
- 232
- 40
- space inside the border
- 346
- True
- purple
- green
- shows a pop-up message
- 80
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids