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 kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
- 2.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
-
3.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
.red { color: yellow; }
.red { color: blue; } (a) yellow (b) orange (c) red (d) blue -
4.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 270px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). - 5.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-family (c) text-align (d) font-weight
- 6.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
-
7.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 12px;
}
} - 8.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
-
9.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 10.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
-
11.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 12.💪 Which flexbox property lines boxes up across? (a) justify-content (b) display: flex (c) align-items (d) gap
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 30px;
border: 4px solid black;
margin: 5px;
} -
14.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 15.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
- 16.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
- 17.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
- 18.What does background-color do? (a) colours behind the text (b) makes the text bold (c) picks the font style (d) sets the letter colour
-
19.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} -
20.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
h2 { color: orange; }
.red { color: black; }
#top { color: yellow; } (a) orange (b) yellow (c) blue (d) black - 21.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
-
22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 10px;
}
} -
23.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
#hero { color: black; }
.big { color: purple; }
h1 { color: yellow; } (a) yellow (b) purple (c) orange (d) black - 24.True or false: CSS makes headings and lists. (a) False (b) True
- 25.🌈 In #4c0000 the red part is the hex number 4c. What is it as a normal number?
- 26.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
-
27.✍️ How many declarations (property: value pairs) are in this rule?
li {
width: 300px;
padding: 8px;
font-style: italic;
margin: 10px;
} - 28.🌈 Which colour of light is strongest in rgb(69, 192, 100)? (a) green (b) red (c) blue
- 29.What does font-family do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) centres a heading
- 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 6 (d) 3
- 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
- 32.What does font-size do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) picks the font style
- 33.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
-
34.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
color: red;
font-weight: bold;
} - 35.💪 Which flexbox property picks row or column? (a) display: flex (b) gap (c) justify-content (d) flex-direction
- 36.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
-
37.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} (a) No (b) Yes -
38.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) No (b) Yes - 39.🌈 Which hex code is black? (a) #ffff00 (b) #0000ff (c) #000000 (d) #ff00ff
-
40.🖌️ What colour are the letters?
h1 {
color: orange;
background-color: white;
text-align: left;
font-size: 28px;
} (a) white (b) orange (c) green
Answer key
- an id selector
- many pages
- blue
- 10
- font-weight
- packs boxes at the end
- 12
- fits every screen
- No
- equal gaps, none at ends
- 40
- align-items
- 218
- 30
- .
- padding
- CSS
- colours behind the text
- 20
- yellow
- the viewport meta tag
- 16
- black
- False
- 76
- JavaScript
- 4
- green
- picks the font style
- 3
- flex-start
- makes letters bigger
- HTML
- 2
- flex-direction
- an element selector
- Yes
- Yes
- #000000
- orange
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids