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 much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 2 boxes, each 100px wide (no margins). -
2.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} -
3.✍️ Which property is set to yellow in this rule?
body {
width: 300px;
border: 2px solid;
background-color: yellow;
text-align: center;
} (a) padding (b) yellow (c) background-color (d) margin -
4.✍️ Which property is set to yellow in this rule?
p {
margin: 10px;
background-color: yellow;
} (a) background-color (b) yellow (c) margin (d) padding - 5.🎯 Which element does the selector #logo style? (a) <span class="logo"> (b) <span id="logo"> (c) <span id="end"> (d) <p class="star">
-
6.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 28px;
}
} - 7.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
- 8.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-family (c) color (d) font-weight
- 9.Which of these does CSS do? (a) makes a link (b) makes headings and lists (c) changes the page live (d) adds space around boxes
- 10.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .html (d) .css
- 11.🌈 Which colour is #0000ff? (a) blue (b) black (c) yellow (d) red
-
12.🖌️ What colour is behind the letters?
h1 {
background-color: green;
font-size: 28px;
color: red;
text-align: right;
} (a) green (b) purple (c) red - 13.Which of these does CSS do? (a) sets colours and fonts (b) counts down a timer (c) gives the page structure (d) puts a picture on a page
- 14.🔍 Which is the odd one out? (a) counts down a timer (b) reacts to a button click (c) checks a quiz answer (d) makes a link
- 15.🌈 Which colour of light is strongest in rgb(82, 157, 25)? (a) blue (b) green (c) red
-
16.🎯 Which CSS selector matches this element?
<span class="note" id="logo">Hello</span> (a) .logo (b) #end (c) p (d) .note -
17.🖌️ Where does the text sit on its line?
h2 {
text-align: right;
color: yellow;
font-size: 32px;
background-color: blue;
} (a) on the left (b) in the middle (c) on the right - 18.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) [ ] (d) ( )
- 19.Which of these does HTML do? (a) puts a picture on a page (b) changes the text size (c) counts down a timer (d) shows a pop-up message
- 20.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
-
21.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
.star { color: purple; }
.star { color: orange; } (a) purple (b) red (c) orange (d) white -
22.✍️ What value is given to border in this rule?
.note {
border: 2px solid;
margin: 10px;
} (a) italic (b) border (c) 2px solid (d) 300px - 23.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
- 24.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
- 25.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a form box (c) changes the page live (d) gives the page structure
- 26.🌈 Which hex code is bright green? (a) #ffffff (b) #0000ff (c) #00ff00 (d) #ffff00
- 27.True or false: HTML puts a picture on a page. (a) True (b) False
-
28.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} -
29.🎯 Which CSS selector matches this element?
<h2 class="menu" id="top">Hello</h2> (a) #menu (b) .menu (c) li (d) .top - 30.🎯 Which sign starts a class selector? (a) # (b) . (c) & (d) @
- 31.🎯 Which element does the selector span style? (a) <p> (b) <h1 class="box"> (c) <span class="box"> (d) <h2 id="hero">
-
32.✍️ Which property is set to 10px in this rule?
p {
margin: 10px;
text-align: center;
} (a) font-weight (b) margin (c) 10px (d) padding - 33.🔍 Which is the odd one out? (a) puts a picture on a page (b) sets colours and fonts (c) makes headings and lists (d) gives the page structure
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 20px;
border: 1px solid black;
margin: 15px;
} - 35.🌈 Which colour is rgb(255, 0, 255)? (a) white (b) magenta (c) cyan (d) red
- 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
- 37.🌈 Which colour of light is strongest in rgb(7, 71, 171)? (a) blue (b) red (c) green
- 38.🌈 Which colour is #ff0000? (a) cyan (b) yellow (c) red (d) black
- 39.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
- 40.True or false: HTML shows a pop-up message. (a) True (b) False
Answer key
- 40
- 18
- background-color
- background-color
- <span id="logo">
- 20
- center
- color
- adds space around boxes
- .css
- blue
- green
- sets colours and fonts
- makes a link
- green
- .note
- on the right
- { }
- puts a picture on a page
- padding
- orange
- 2px solid
- :
- packs boxes at the end
- changes the page live
- #00ff00
- True
- 28
- .menu
- .
- <span class="box">
- margin
- sets colours and fonts
- 152
- magenta
- 800px or wider
- blue
- red
- #
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids