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 hex code is white? (a) #00ffff (b) #ff00ff (c) #ffff00 (d) #ffffff
-
2.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-weight: bold;
width: 300px;
} - 3.True or false: li is an element selector. (a) True (b) False
- 4.What does color do? (a) colours behind the text (b) sets the letter colour (c) makes the text bold (d) centres a heading
-
5.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 330px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). - 6.What does background-color do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) makes letters bigger
- 7.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Computer Style Sheets (d) Creative Sheet System
- 8.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) border (d) margin
-
9.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 10.🌈 Which colour is #000000? (a) yellow (b) red (c) cyan (d) black
- 11.True or false: the border is the gap round content. (a) True (b) False
- 12.True or false: the border is a solid or dotted edge. (a) True (b) False
- 13.True or false: HTML checks a quiz answer. (a) False (b) True
-
14.📦 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: 25px;
border: 5px solid black;
margin: 0px;
} - 15.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
-
16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 15px;
border: 4px solid black;
margin: 10px;
} -
17.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 210px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins). - 18.True or false: img is a class selector. (a) True (b) False
-
19.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 290px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). -
20.✍️ What value is given to width in this rule?
h1 {
padding: 8px;
width: 300px;
text-align: center;
} (a) width (b) 300px (c) italic (d) red - 21.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
- 22.📦 In the box model, which part is the text or picture? (a) border (b) margin (c) padding (d) content
-
23.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
#end { color: white; }
#end { color: green; } (a) green (b) red (c) blue (d) white -
24.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 25px;
border: 1px solid black;
margin: 20px;
} -
25.✍️ What value is given to font-size in this rule?
li {
font-size: 20px;
padding: 8px;
} (a) center (b) 20px (c) font-size (d) yellow -
26.✍️ Which property is set to yellow in this rule?
h1 {
color: red;
background-color: yellow;
font-weight: bold;
text-align: center;
} (a) padding (b) yellow (c) margin (d) background-color -
27.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} - 28.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) red (c) magenta (d) white
-
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} - 30.True or false: JavaScript adds space around boxes. (a) True (b) False
-
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 320px;
justify-content: center;
}
Inside are 4 boxes, each 60px wide (no margins). -
32.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 360px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). - 33.🌈 In #b20000 the red part is the hex number b2. What is it as a normal number?
- 34.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
-
35.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
p { color: blue; }
p { color: red; } (a) blue (b) orange (c) red (d) green - 36.🎯 What kind of selector is li? (a) an element selector (b) a class selector (c) an id selector
-
37.🖌️ What colour are the letters?
li {
background-color: green;
font-size: 12px;
text-align: left;
color: red;
} (a) black (b) green (c) red - 38.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
- 39.🌈 In #000088 the blue part is the hex number 88. What is it as a normal number?
- 40.🌈 Which hex code is black? (a) #ffffff (b) #000000 (c) #ff00ff (d) #ffff00
Answer key
- #ffffff
- 2
- True
- sets the letter colour
- 30
- colours behind the text
- Cascading Style Sheets
- border
- 16
- black
- False
- True
- False
- 110
- <link>
- 168
- 50
- False
- 50
- 300px
- a class selector
- content
- green
- 202
- 20px
- background-color
- 24
- yellow
- 206
- False
- 40
- 60
- 178
- JavaScript
- red
- an element selector
- red
- margin
- 136
- #000000
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids