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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
- 2.💪 Which flexbox property picks row or column? (a) gap (b) justify-content (c) flex-direction (d) align-items
- 3.True or false: #main is an id selector. (a) False (b) True
-
4.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 3 boxes, each 60px wide (no margins). -
5.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} -
6.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
text-align: center;
color: red;
} -
7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} - 8.🔍 Which is the odd one out? (a) sets colours and fonts (b) counts down a timer (c) changes the text size (d) rounds box corners
- 9.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
-
10.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 14px;
}
} - 11.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
- 12.True or false: margin is the gap round content. (a) False (b) True
- 13.🌈 Which colour is #000000? (a) magenta (b) red (c) black (d) bright green
-
14.✍️ How many declarations (property: value pairs) are in this rule?
p {
padding: 8px;
} - 15.🔍 Which is the odd one out? (a) sets colours and fonts (b) puts a picture on a page (c) makes a form box (d) makes headings and lists
-
16.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} -
17.✍️ What is the selector in this CSS rule?
h1 {
padding: 8px;
font-size: 20px;
} (a) 20px (b) padding (c) h1 (d) p - 18.🎯 Which sign starts an id selector? (a) @ (b) & (c) . (d) #
-
19.🖌️ What colour are the letters?
h1 {
color: orange;
text-align: right;
font-size: 20px;
background-color: white;
} (a) orange (b) white (c) red -
20.🖌️ What colour are the letters?
h1 {
background-color: red;
font-size: 40px;
text-align: left;
color: orange;
} (a) green (b) red (c) orange - 21.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) picks the font style
- 22.🌈 Which colour of light is strongest in rgb(158, 3, 102)? (a) blue (b) red (c) green
- 23.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
- 24.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
-
25.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
font-style: italic;
} -
26.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
p { color: blue; }
#logo { color: red; }
.big { color: green; } (a) red (b) purple (c) blue (d) green - 27.True or false: #main is a class selector. (a) True (b) False
- 28.🎯 Which element does the selector .menu style? (a) <h2 class="menu"> (b) <li class="big"> (c) <h2 id="menu"> (d) <h2 class="note">
- 29.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
-
30.🖌️ What colour are the letters?
h2 {
color: purple;
background-color: orange;
text-align: left;
font-size: 12px;
} (a) blue (b) orange (c) purple -
31.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 32.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) blue (d) red
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} - 34.True or false: the border is the gap to other boxes. (a) True (b) False
- 35.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the viewport meta tag (d) the hr tag
-
36.✍️ What value is given to border in this rule?
#top {
border: 2px solid;
font-weight: bold;
} (a) 2px solid (b) 300px (c) border (d) italic -
37.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 460px;
justify-content: flex-start;
}
Inside are 4 boxes, each 100px wide (no margins). - 38.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) yellow (c) red (d) bright green
- 39.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
-
40.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 320px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins).
Answer key
- the later one
- flex-direction
- True
- 80
- 24
- 2
- 22
- counts down a timer
- red
- 12
- <link>
- False
- black
- 1
- sets colours and fonts
- 200
- h1
- #
- orange
- orange
- makes letters bigger
- red
- padding
- many pages
- 2
- red
- False
- <h2 class="menu">
- CSS
- purple
- 50
- blue
- 176
- False
- the viewport meta tag
- 2px solid
- 60
- bright green
- an id selector
- 80
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids