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 colour is behind the letters?
h1 {
text-align: center;
font-size: 28px;
color: green;
background-color: orange;
} (a) green (b) red (c) orange - 2.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
- 3.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) red (c) cyan (d) black
- 4.✍️ In color: blue; which part is the value? (a) blue (b) : (c) color (d) ;
- 5.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <css> (d) <img>
- 6.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
- 7.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
- 8.What does justify-content: space-between 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
- 9.True or false: margin is space outside the border. (a) False (b) True
-
10.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} (a) Yes (b) No -
11.💪 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 50px wide (no margins). - 12.True or false: h1 is an element selector. (a) True (b) False
- 13.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
-
14.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 20px;
border: 1px solid black;
margin: 5px;
} -
15.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
#intro { color: blue; }
#intro { color: purple; } (a) white (b) orange (c) purple (d) blue -
16.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 17.What does font-size do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) colours behind the text
-
18.✍️ How many declarations (property: value pairs) are in this rule?
.note {
width: 300px;
font-weight: bold;
font-style: italic;
} -
19.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} - 20.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="star"> (c) <span id="hero"> (d) <h2 class="star">
-
21.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-size: 20px;
color: red;
} - 22.🎯 What kind of selector is img? (a) a class selector (b) an id selector (c) an element selector
-
23.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 24.Which of these is margin? (a) the text or picture (b) a solid or dotted edge (c) the line round the box (d) the gap to other boxes
-
25.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
h2 { color: yellow; }
.star { color: orange; } (a) green (b) yellow (c) white (d) orange - 26.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) red (d) blue
- 27.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) no pages (d) many pages
-
28.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). - 29.🎯 Which element does the selector div style? (a) <h1 id="end"> (b) <div class="big"> (c) <p class="big"> (d) <span>
- 30.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
-
31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} - 32.📱 What does a media query check? (a) the screen width (b) the battery level (c) the time of day (d) the page title
- 33.🌈 Which hex code is blue? (a) #0000ff (b) #000000 (c) #00ffff (d) #ff00ff
-
34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} -
35.✍️ How many declarations (property: value pairs) are in this rule?
body {
background-color: yellow;
width: 300px;
} - 36.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) blue (c) cyan (d) bright green
-
37.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} - 38.🎯 Which element does the selector div style? (a) <h1 id="end"> (b) <p class="star"> (c) <div class="star"> (d) <span>
- 39.Which of these does HTML do? (a) adds space around boxes (b) shows a pop-up message (c) makes headings and lists (d) changes the text size
- 40.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
Answer key
- orange
- HTML
- red
- blue
- <link>
- ;
- color
- equal gaps, none at ends
- True
- No
- 50
- True
- CSS
- 202
- purple
- 18
- makes letters bigger
- 3
- 24
- <h2 class="star">
- 2
- an element selector
- Yes
- the gap to other boxes
- orange
- red
- many pages
- 40
- <div class="big">
- CSS
- 24
- the screen width
- #0000ff
- 20
- 2
- blue
- 12
- <div class="star">
- makes headings and lists
- fits every screen
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids