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.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} - 2.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
- 3.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) { } (d) < >
- 4.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) font-size (d) background-color
-
5.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} (a) No (b) Yes - 6.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) yellow (c) white (d) blue
-
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 150px;
padding: 15px;
border: 2px solid black;
margin: 10px;
} - 8.True or false: the content is space outside the border. (a) False (b) True
-
9.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 10.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
- 11.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
- 12.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
- 13.💪 Which flexbox property lines boxes up across? (a) align-items (b) justify-content (c) display: flex (d) flex-direction
- 14.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 15.🌈 Which colour is #00ff00? (a) cyan (b) bright green (c) white (d) magenta
-
16.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} -
17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} - 18.Which of these does CSS do? (a) adds space around boxes (b) makes a form box (c) checks a quiz answer (d) makes headings and lists
- 19.🌈 Which colour is #0000ff? (a) red (b) bright green (c) black (d) blue
- 20.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
-
21.🖌️ How big is the text, in px?
p {
font-size: 32px;
text-align: left;
background-color: black;
color: red;
} -
22.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
- 24.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 25.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) padding (d) border
- 26.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
- 27.🖌️ Which CSS property sets the letter colour? (a) color (b) text-align (c) font-weight (d) background-color
- 28.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space outside the border (d) the gap round content
-
29.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
.menu { color: black; }
#intro { color: white; }
p { color: orange; } (a) white (b) yellow (c) black (d) orange - 30.🌈 Which hex code is red? (a) #ff0000 (b) #000000 (c) #ffffff (d) #ffff00
- 31.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
- 32.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) gap (d) flex-direction
- 33.🌈 Which hex code is bright green? (a) #ff0000 (b) #00ff00 (c) #ff00ff (d) #ffff00
-
34.✍️ What value is given to font-style in this rule?
#top {
margin: 10px;
font-size: 20px;
font-style: italic;
} (a) red (b) font-style (c) italic (d) 20px -
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 5px solid black;
margin: 5px;
} -
36.🎯 Which CSS selector matches this element?
<h1 class="box" id="end">Hello</h1> (a) h1 (b) .end (c) .star (d) h2 - 37.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
- 38.🔍 Which is the odd one out? (a) makes headings and lists (b) checks a quiz answer (c) changes the page live (d) shows a pop-up message
-
39.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 460px;
justify-content: space-between;
}
Inside are 4 boxes, each 100px wide (no margins). -
40.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 2 boxes, each 80px wide (no margins).
Answer key
- 24
- flex-start
- { }
- font-family
- Yes
- blue
- 204
- False
- Yes
- the screen width
- blue
- equal gaps, none at ends
- align-items
- an element selector
- bright green
- 12
- 24
- adds space around boxes
- blue
- CSS
- 32
- Yes
- 3
- an id selector
- padding
- a class selector
- color
- the text or picture
- white
- #ff0000
- an element selector
- flex-direction
- #00ff00
- italic
- 160
- h1
- 800px or wider
- makes headings and lists
- 20
- 20
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids