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 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 2.🌈 In #000027 the blue part is the hex number 27. What is it as a normal number?
- 3.True or false: padding is space inside the border. (a) False (b) True
- 4.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) rounds box corners (d) shows a pop-up message
- 5.💪 Which flexbox property lines boxes up across? (a) display: flex (b) align-items (c) flex-direction (d) justify-content
- 6.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
- 7.🎨 Which attribute adds CSS inside one tag? (a) href (b) style (c) src (d) alt
- 8.🌈 Which colour of light is strongest in rgb(26, 41, 253)? (a) blue (b) red (c) green
-
9.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). - 10.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) J (c) G (d) Z
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 5px;
border: 1px solid black;
margin: 15px;
} -
12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 13.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
- 14.What does color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) picks the font style
- 15.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
- 16.🌈 Which colour is #000000? (a) black (b) yellow (c) blue (d) white
-
17.✍️ Which property is set to bold in this rule?
body {
background-color: yellow;
width: 300px;
border: 2px solid;
font-weight: bold;
} (a) font-weight (b) width (c) bold (d) border -
18.🖌️ What colour is behind the letters?
h1 {
color: green;
background-color: purple;
font-size: 16px;
text-align: left;
} (a) green (b) orange (c) purple -
19.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: red; } (a) green (b) purple (c) orange (d) red - 20.🌈 Which colour is #00ff00? (a) bright green (b) white (c) yellow (d) red
-
21.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} - 22.True or false: JavaScript counts down a timer. (a) False (b) True
- 23.True or false: HTML shows a pop-up message. (a) False (b) True
-
24.✍️ What value is given to font-weight in this rule?
h2 {
font-weight: bold;
background-color: yellow;
text-align: center;
} (a) 2px solid (b) 300px (c) bold (d) font-weight - 25.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) border (d) margin
- 26.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
- 27.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
-
28.🎯 Which CSS selector matches this element?
<li class="star" id="end">Hello</li> (a) .end (b) .menu (c) div (d) li - 29.True or false: JavaScript makes a form box. (a) True (b) False
- 30.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
- 31.True or false: padding is the gap to other boxes. (a) True (b) False
- 32.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) bright green (c) yellow (d) black
- 33.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) flex-start (d) center
- 34.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
-
35.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} - 36.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) changes the text size (d) adds space around boxes
- 37.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) yellow (c) magenta (d) black
- 38.Which of these does HTML do? (a) sets colours and fonts (b) checks a quiz answer (c) makes a form box (d) changes the text size
-
39.🖌️ What colour is behind the letters?
h2 {
text-align: center;
background-color: orange;
font-size: 40px;
color: blue;
} (a) blue (b) orange (c) white -
40.✍️ What value is given to background-color in this rule?
h1 {
background-color: yellow;
color: red;
width: 300px;
font-style: italic;
} (a) 8px (b) yellow (c) 10px (d) background-color
Answer key
- Yes
- 39
- True
- rounds box corners
- align-items
- a class selector
- style
- blue
- 80
- F
- 122
- 18
- the screen width
- sets the letter colour
- equal gaps, none at ends
- black
- font-weight
- purple
- red
- bright green
- 16
- True
- False
- bold
- border
- { }
- space-between
- li
- False
- :
- False
- yellow
- flex-start
- blue
- 20
- gives the page structure
- magenta
- makes a form box
- orange
- yellow
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids