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.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) fits every screen (d) is only for laptops
-
2.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
3.🖌️ What colour are the letters?
p {
font-size: 16px;
text-align: center;
color: red;
background-color: white;
} (a) red (b) white (c) green -
4.⚖️ What colour is the text of this element?
<p class="note" id="logo">Hi</p>
CSS:
p { color: green; }
p { color: black; } (a) yellow (b) red (c) green (d) black - 5.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
- 6.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) display: flex (d) flex-direction
- 7.🌈 Which colour of light is strongest in rgb(196, 90, 82)? (a) blue (b) green (c) red
- 8.🌈 Which colour is #0000ff? (a) red (b) bright green (c) blue (d) white
- 9.🎯 Which element does the selector #top style? (a) <li id="top"> (b) <div class="star"> (c) <li class="top"> (d) <li id="intro">
-
10.🖌️ What colour are the letters?
p {
background-color: blue;
text-align: left;
color: black;
font-size: 20px;
} (a) black (b) yellow (c) blue -
11.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
p { color: red; }
p { color: green; } (a) yellow (b) blue (c) red (d) green - 12.🌈 In #000049 the blue part is the hex number 49. What is it as a normal number?
- 13.🌈 Which colour of light is strongest in rgb(138, 82, 151)? (a) green (b) blue (c) red
-
14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 15.What does color do? (a) colours behind the text (b) picks the font style (c) centres a heading (d) sets the letter colour
- 16.What does font-family do? (a) centres a heading (b) makes letters bigger (c) colours behind the text (d) picks the font style
-
17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 5px;
border: 2px solid black;
margin: 15px;
} - 18.🎯 Which sign starts an id selector? (a) @ (b) # (c) . (d) &
-
19.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 270px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). -
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 80px;
padding: 10px;
border: 3px solid black;
margin: 10px;
} -
21.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 120px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
22.✍️ What value is given to border in this rule?
body {
border: 2px solid;
font-size: 20px;
margin: 10px;
} (a) 2px solid (b) italic (c) 300px (d) border - 23.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
- 24.🌈 Which colour of light is strongest in rgb(242, 115, 92)? (a) red (b) green (c) blue
- 25.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
- 26.📱 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
-
27.✍️ How many declarations (property: value pairs) are in this rule?
#top {
background-color: yellow;
border: 2px solid;
width: 300px;
} - 28.🖌️ Which CSS property picks the font style? (a) font-family (b) font-size (c) text-align (d) background-color
- 29.🔍 Which is the odd one out? (a) changes the page live (b) sets colours and fonts (c) lays out the page (d) changes the text size
-
30.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 31.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
-
32.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
h1 { color: white; }
h1 { color: blue; } (a) purple (b) yellow (c) blue (d) white - 33.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 6 (d) 3
- 34.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
-
35.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
#hero { color: red; }
p { color: blue; } (a) orange (b) blue (c) yellow (d) red -
36.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 250px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). - 37.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) display: flex (c) justify-content (d) flex-direction
-
38.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). - 39.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
- 40.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
Answer key
- fits every screen
- 132
- red
- black
- .
- align-items
- red
- blue
- <li id="top">
- black
- green
- 73
- blue
- 12
- sets the letter colour
- picks the font style
- 254
- #
- 70
- 106
- 20
- 2px solid
- equal gaps, none at ends
- red
- center
- the viewport meta tag
- 3
- font-family
- changes the page live
- Yes
- .css
- blue
- 3
- an id selector
- red
- 50
- justify-content
- 70
- JavaScript
- CSS
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids