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 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
- 2.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) magenta (c) red (d) black
-
3.🖌️ What colour is behind the letters?
p {
text-align: center;
font-size: 28px;
background-color: black;
color: orange;
} (a) black (b) green (c) orange -
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 10px;
border: 5px solid black;
margin: 15px;
} -
5.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
text-align: center;
margin: 10px;
border: 2px solid;
} - 6.💪 Which flexbox property sets space between boxes? (a) display: flex (b) flex-direction (c) justify-content (d) gap
-
7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} - 8.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
-
9.✍️ Which property is set to center in this rule?
h1 {
text-align: center;
padding: 8px;
color: red;
font-weight: bold;
} (a) text-align (b) margin (c) background-color (d) center -
10.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). -
11.✍️ Which property is set to 8px in this rule?
h2 {
width: 300px;
font-size: 20px;
padding: 8px;
background-color: yellow;
} (a) font-weight (b) padding (c) 8px (d) border -
12.✍️ How many declarations (property: value pairs) are in this rule?
.note {
text-align: center;
border: 2px solid;
} - 13.🎨 Which attribute adds CSS inside one tag? (a) style (b) alt (c) src (d) href
- 14.True or false: HTML makes headings and lists. (a) False (b) True
- 15.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
-
16.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 17.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
-
18.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 330px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). - 19.🎯 Which element does the selector p style? (a) <h2 class="red"> (b) <p class="red"> (c) <h1> (d) <li id="intro">
- 20.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
- 21.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 22.What does font-weight do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
- 23.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
- 24.What does text-align do? (a) picks the font style (b) makes letters bigger (c) centres a heading (d) sets the letter colour
- 25.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) gap (d) align-items
- 26.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
-
27.✍️ What value is given to font-style in this rule?
p {
font-style: italic;
padding: 8px;
} (a) red (b) 20px (c) italic (d) font-style -
28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} -
29.🖌️ Where does the text sit on its line?
li {
background-color: green;
text-align: left;
font-size: 32px;
color: purple;
} (a) on the right (b) on the left (c) in the middle - 30.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 15px;
border: 1px solid black;
margin: 20px;
} -
32.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
h1 { color: red; }
h1 { color: white; } (a) blue (b) white (c) green (d) red - 33.Which of these does CSS do? (a) rounds box corners (b) makes a link (c) changes the page live (d) reacts to a button click
-
34.✍️ Which property is set to 20px in this rule?
.box {
font-size: 20px;
border: 2px solid;
margin: 10px;
background-color: yellow;
} (a) background-color (b) font-size (c) text-align (d) 20px - 35.🌈 Which hex code is bright green? (a) #0000ff (b) #00ffff (c) #ffff00 (d) #00ff00
-
36.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 37.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
-
38.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} - 39.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) space inside the border (d) the line round the box
-
40.✍️ Which property is set to 300px in this rule?
h1 {
width: 300px;
margin: 10px;
color: red;
} (a) width (b) 300px (c) font-style (d) color
Answer key
- packs boxes at the end
- cyan
- black
- 250
- 4
- gap
- 8
- the screen width
- text-align
- 80
- padding
- 2
- style
- True
- HTML
- 10
- flex-direction
- 30
- <p class="red">
- HTML
- an element selector
- makes the text bold
- HTML
- centres a heading
- justify-content
- an id selector
- italic
- 14
- on the left
- margin
- 222
- white
- rounds box corners
- font-size
- #00ff00
- 234
- JavaScript
- 22
- the gap to other boxes
- width
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids