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 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). - 2.🎯 Can many elements share the same class? (a) Yes (b) No
- 3.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) reacts to a button click (d) adds space around boxes
-
4.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 5.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) Z (d) J
- 6.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
- 7.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
-
8.🖌️ Where does the text sit on its line?
h1 {
font-size: 12px;
background-color: orange;
text-align: left;
color: purple;
} (a) on the left (b) in the middle (c) on the right - 9.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
- 10.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
-
11.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 12px;
}
} - 12.Which of these is the content? (a) the line round the box (b) the text or picture (c) a solid or dotted edge (d) space inside the border
-
13.🖌️ How big is the text, in px?
p {
background-color: blue;
color: green;
text-align: right;
font-size: 40px;
} -
14.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 22px;
}
} -
15.🖌️ What colour is behind the letters?
h2 {
background-color: orange;
text-align: center;
font-size: 20px;
color: yellow;
} (a) white (b) orange (c) yellow - 16.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
-
17.🖌️ How big is the text, in px?
h2 {
background-color: yellow;
text-align: center;
font-size: 36px;
color: purple;
} -
18.🖌️ How big is the text, in px?
h1 {
background-color: white;
font-size: 36px;
color: orange;
text-align: left;
} - 19.🌈 Which colour is #ffff00? (a) blue (b) black (c) yellow (d) white
- 20.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
- 21.True or false: HTML sets colours and fonts. (a) False (b) True
-
22.✍️ What value is given to background-color in this rule?
h2 {
background-color: yellow;
text-align: center;
} (a) 10px (b) yellow (c) 8px (d) background-color - 23.🌈 Which colour is rgb(255, 0, 0)? (a) bright green (b) magenta (c) blue (d) red
- 24.True or false: JavaScript changes the page live. (a) True (b) False
- 25.True or false: the border is a solid or dotted edge. (a) False (b) True
-
26.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-style: italic;
} - 27.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
- 28.🔍 Which is the odd one out? (a) shows a pop-up message (b) checks a quiz answer (c) gives the page structure (d) counts down a timer
-
29.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
#logo { color: orange; }
.big { color: green; } (a) purple (b) green (c) blue (d) orange - 30.📱 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
-
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). - 32.True or false: the border is the line round the box. (a) True (b) False
- 33.🖌️ Which CSS property makes the text bold? (a) font-size (b) color (c) text-align (d) font-weight
- 34.What does font-family do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) centres a heading
-
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 5px;
border: 1px solid black;
margin: 10px;
} - 36.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) blue (c) cyan (d) bright green
-
37.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 3 boxes, each 40px wide (no margins). -
38.⚖️ What colour is the text of this element?
<h2 class="note" id="hero">Hi</h2>
CSS:
.note { color: white; }
.note { color: orange; } (a) red (b) white (c) orange (d) black - 39.🎯 Which element does the selector h2 style? (a) <div class="big"> (b) <li> (c) <span id="intro"> (d) <h2 class="big">
- 40.🧩 Which language rounds box corners? (a) CSS (b) HTML (c) JavaScript
Answer key
- 10
- Yes
- puts a picture on a page
- Yes
- F
- #
- ;
- on the left
- puts boxes in the middle
- the screen width
- 12
- the text or picture
- 40
- 22
- orange
- packs boxes at the start
- 36
- 36
- yellow
- 600px or narrower
- False
- yellow
- red
- True
- True
- 1
- space-between
- gives the page structure
- orange
- the viewport meta tag
- 20
- True
- font-weight
- picks the font style
- 302
- bright green
- 30
- orange
- <h2 class="big">
- CSS
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids