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.🎯 Which sign starts an id selector? (a) # (b) . (c) @ (d) &
- 2.💪 Which flexbox property turns on flexbox? (a) justify-content (b) flex-direction (c) display: flex (d) align-items
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} -
4.🖌️ What colour is behind the letters?
h1 {
text-align: left;
color: black;
background-color: red;
font-size: 12px;
} (a) blue (b) red (c) black - 5.💪 Which flexbox property spaces boxes along a row? (a) gap (b) display: flex (c) align-items (d) justify-content
- 6.🎯 Which sign starts a class selector? (a) . (b) @ (c) & (d) #
- 7.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
- 8.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) space-between (d) flex-end
- 9.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) changes the page live (d) shows a pop-up message
- 10.🌈 Which colour is #00ffff? (a) black (b) cyan (c) bright green (d) yellow
-
11.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 25px;
border: 2px solid black;
margin: 20px;
} - 12.What does background-color do? (a) sets the letter colour (b) picks the font style (c) makes letters bigger (d) colours behind the text
- 13.What does font-family do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes the text bold
- 14.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) white (c) black (d) bright green
-
15.✍️ What is the selector in this CSS rule?
.box {
color: red;
text-align: center;
font-style: italic;
background-color: yellow;
} (a) color (b) center (c) .box (d) h2 -
16.⚖️ What colour is the text of this element?
<h1 class="note" id="hero">Hi</h1>
CSS:
h1 { color: white; }
#hero { color: blue; }
.note { color: orange; } (a) orange (b) red (c) blue (d) white -
17.✍️ What value is given to margin in this rule?
.note {
margin: 10px;
border: 2px solid;
} (a) bold (b) 10px (c) 8px (d) margin -
18.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
width: 300px;
color: red;
} -
19.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
border: 2px solid;
color: red;
} -
20.✍️ How many declarations (property: value pairs) are in this rule?
li {
text-align: center;
margin: 10px;
} - 21.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
-
22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 23.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
- 24.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
-
25.✍️ How many declarations (property: value pairs) are in this rule?
li {
margin: 10px;
padding: 8px;
} -
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 320px;
justify-content: space-between;
}
Inside are 3 boxes, each 60px wide (no margins). -
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). - 28.Which of these is padding? (a) a solid or dotted edge (b) space inside the border (c) the line round the box (d) the text or picture
-
29.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
font-weight: bold;
margin: 10px;
} -
30.🖌️ What colour are the letters?
h1 {
color: red;
font-size: 24px;
background-color: black;
text-align: center;
} (a) red (b) white (c) black - 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) J (c) G (d) F
-
32.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: blue; } (a) orange (b) purple (c) blue (d) red -
33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} -
34.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 280px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 35.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) sets colours and fonts (d) checks a quiz answer
- 36.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) flex-end (d) center
- 37.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
- 38.🧩 Which language adds space around boxes? (a) CSS (b) HTML (c) JavaScript
- 39.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) alt (d) href
- 40.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
Answer key
- #
- display: flex
- 112
- red
- justify-content
- .
- fits every screen
- space-between
- puts a picture on a page
- cyan
- 194
- colours behind the text
- picks the font style
- blue
- .box
- blue
- 10px
- 2
- 2
- 2
- :
- 142
- CSS
- ;
- 2
- 70
- 40
- space inside the border
- 3
- red
- F
- blue
- 22
- 80
- checks a quiz answer
- flex-start
- packs boxes at the start
- CSS
- style
- an id selector
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids