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.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 240px;
padding: 5px;
border: 4px solid black;
margin: 10px;
} -
2.🖌️ What colour is behind the letters?
h1 {
background-color: black;
font-size: 20px;
text-align: center;
color: purple;
} (a) purple (b) black (c) blue - 3.🌈 In #000008 the blue part is the hex number 08. What is it as a normal number?
- 4.Which of these does JavaScript do? (a) rounds box corners (b) adds space around boxes (c) lays out the page (d) checks a quiz answer
- 5.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) blue (c) white (d) red
-
6.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
} - 7.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
-
8.🖌️ What colour is behind the letters?
p {
font-size: 24px;
text-align: right;
color: red;
background-color: orange;
} (a) orange (b) black (c) red - 9.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
- 10.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) . (d) :
- 11.True or false: margin is space outside the border. (a) True (b) False
-
12.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} - 13.Which of these is the border? (a) the gap to other boxes (b) the text or picture (c) a solid or dotted edge (d) space inside the border
-
14.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
15.✍️ What value is given to color in this rule?
#top {
color: red;
font-style: italic;
} (a) red (b) center (c) color (d) 20px - 16.Which of these does HTML do? (a) puts a picture on a page (b) reacts to a button click (c) lays out the page (d) changes the text size
-
17.🖌️ What colour is behind the letters?
p {
text-align: center;
color: green;
font-size: 12px;
background-color: orange;
} (a) yellow (b) green (c) orange - 18.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
- 19.True or false: padding is the gap round content. (a) False (b) True
- 20.🔍 Which is the odd one out? (a) reacts to a button click (b) shows a pop-up message (c) checks a quiz answer (d) puts a picture on a page
-
21.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
- 23.🌈 Which colour of light is strongest in rgb(99, 193, 38)? (a) green (b) red (c) blue
- 24.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
-
25.✍️ What value is given to padding in this rule?
p {
font-weight: bold;
padding: 8px;
width: 300px;
} (a) bold (b) 2px solid (c) padding (d) 8px - 26.Which of these does JavaScript do? (a) counts down a timer (b) gives the page structure (c) rounds box corners (d) makes a form box
- 27.🔍 Which is the odd one out? (a) changes the text size (b) rounds box corners (c) lays out the page (d) makes headings and lists
-
28.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). - 29.Which of these does HTML do? (a) shows a pop-up message (b) makes a link (c) counts down a timer (d) reacts to a button click
- 30.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
-
31.⚖️ What colour is the text of this element?
<p class="red" id="end">Hi</p>
CSS:
p { color: white; }
p { color: green; } (a) white (b) green (c) yellow (d) purple - 32.True or false: the content is space outside the border. (a) True (b) False
- 33.What does font-size do? (a) sets the letter colour (b) colours behind the text (c) centres a heading (d) makes letters bigger
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} - 35.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) blue (c) yellow (d) red
- 36.What does background-color do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) makes the text bold
-
37.🖌️ What colour are the letters?
p {
text-align: center;
font-size: 40px;
color: red;
background-color: orange;
} (a) green (b) red (c) orange - 38.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
-
39.✍️ What value is given to margin in this rule?
.note {
width: 300px;
margin: 10px;
} (a) 10px (b) 8px (c) margin (d) bold -
40.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
text-align: center;
margin: 10px;
}
Answer key
- 278
- black
- 8
- checks a quiz answer
- bright green
- 1
- an id selector
- orange
- 600px or narrower
- ;
- True
- 12
- a solid or dotted edge
- No
- red
- puts a picture on a page
- orange
- flex-start
- True
- puts a picture on a page
- Yes
- the later one
- green
- red
- 8px
- counts down a timer
- makes headings and lists
- 70
- makes a link
- 800px or wider
- green
- False
- makes letters bigger
- 92
- yellow
- colours behind the text
- red
- CSS
- 10px
- 2
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids