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 CSS property colours behind the text? (a) font-family (b) font-size (c) background-color (d) font-weight
-
2.✍️ What value is given to text-align in this rule?
#top {
font-weight: bold;
text-align: center;
} (a) text-align (b) yellow (c) 10px (d) center - 3.🎨 A CSS file usually ends with which extension? (a) .html (b) .png (c) .css (d) .js
- 4.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
- 5.🌈 Which colour is #ff00ff? (a) white (b) cyan (c) blue (d) magenta
- 6.True or false: padding is the line round the box. (a) False (b) True
- 7.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) changes the page live (d) shows a pop-up message
-
8.🖌️ What colour are the letters?
p {
text-align: center;
background-color: red;
font-size: 12px;
color: black;
} (a) black (b) green (c) red -
9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 10.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the text size (c) adds space around boxes (d) sets colours and fonts
- 11.🎯 Which sign starts an id selector? (a) # (b) @ (c) . (d) &
-
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 290px;
justify-content: center;
}
Inside are 3 boxes, each 50px wide (no margins). - 13.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) margin (d) border
-
14.✍️ How many declarations (property: value pairs) are in this rule?
li {
background-color: yellow;
margin: 10px;
font-weight: bold;
} -
15.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 16.True or false: .note is a class selector. (a) False (b) True
-
17.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 220px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). - 18.🖌️ Which CSS property makes the text bold? (a) font-family (b) background-color (c) font-weight (d) font-size
- 19.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) puts a picture on a page (d) gives the page structure
- 20.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 2 (d) 5
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 30px;
border: 5px solid black;
margin: 15px;
} -
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 2px solid black;
margin: 15px;
} - 23.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
-
24.🖌️ What colour is behind the letters?
h1 {
color: green;
font-size: 36px;
background-color: red;
text-align: right;
} (a) red (b) green (c) blue - 25.What does background-color do? (a) makes the text bold (b) picks the font style (c) makes letters bigger (d) colours behind the text
-
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 25px;
border: 2px solid black;
margin: 0px;
} - 27.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
- 28.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
- 29.📦 In the box model, which part is the line round the box? (a) border (b) content (c) padding (d) margin
- 30.🎯 Which element does the selector p style? (a) <h1> (b) <h2 class="note"> (c) <p class="note"> (d) <li id="top">
- 31.True or false: HTML changes the text size. (a) False (b) True
-
32.🖌️ How big is the text, in px?
h1 {
color: yellow;
text-align: center;
font-size: 28px;
background-color: green;
} -
33.✍️ Which property is set to italic in this rule?
.box {
text-align: center;
font-style: italic;
} (a) italic (b) color (c) font-style (d) font-size -
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 35.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
- 36.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
-
37.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 8px;
}
} (a) No (b) Yes - 38.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
-
39.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
40.✍️ What is the selector in this CSS rule?
.note {
font-size: 20px;
text-align: center;
} (a) font-size (b) #top (c) .note (d) center
Answer key
- background-color
- center
- .css
- the viewport meta tag
- magenta
- False
- puts a picture on a page
- black
- 242
- shows a pop-up message
- #
- 70
- padding
- 3
- 10
- True
- 70
- font-weight
- reacts to a button click
- 1
- 210
- 134
- an element selector
- red
- colours behind the text
- 124
- an id selector
- CSS
- border
- <p class="note">
- False
- 28
- font-style
- 162
- JavaScript
- padding
- No
- 255
- 10
- .note
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids