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.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
- 2.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) font-weight (d) font-family
-
3.✍️ What is the selector in this CSS rule?
.note {
font-weight: bold;
color: red;
} (a) .note (b) font-weight (c) red (d) #top -
4.🎯 Which CSS selector matches this element?
<li class="note" id="intro">Hello</li> (a) .intro (b) .big (c) .note (d) #note - 5.🌈 Which colour of light is strongest in rgb(222, 108, 58)? (a) red (b) green (c) blue
- 6.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
-
7.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
#main { color: red; }
p { color: green; } (a) yellow (b) green (c) red (d) orange - 8.True or false: the content is a solid or dotted edge. (a) False (b) True
- 9.Which of these does HTML do? (a) puts a picture on a page (b) reacts to a button click (c) counts down a timer (d) changes the page live
-
10.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
h1 { color: yellow; }
h1 { color: green; } (a) yellow (b) green (c) black (d) red -
11.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
p { color: yellow; }
p { color: purple; } (a) yellow (b) white (c) purple (d) black -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} - 13.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
- 14.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) text-align (d) background-color
-
15.✍️ What is the selector in this CSS rule?
#top {
margin: 10px;
color: red;
} (a) li (b) red (c) #top (d) margin -
16.✍️ What value is given to padding in this rule?
p {
padding: 8px;
margin: 10px;
border: 2px solid;
} (a) 8px (b) padding (c) bold (d) 2px solid - 17.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
- 18.🎯 Which sign starts an id selector? (a) . (b) @ (c) # (d) &
- 19.Which of these is the content? (a) the text or picture (b) space outside the border (c) the gap round content (d) the gap to other boxes
-
20.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
#intro { color: green; }
p { color: red; } (a) blue (b) red (c) white (d) green -
21.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} - 22.💪 Which flexbox property picks row or column? (a) align-items (b) gap (c) justify-content (d) flex-direction
-
23.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 8px;
}
} -
24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 10px;
border: 4px solid black;
margin: 10px;
} -
25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 60px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} -
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 10px;
border: 1px solid black;
margin: 10px;
} -
27.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 28.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
- 29.What does justify-content: space-between 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
- 30.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
-
31.✍️ What value is given to font-weight in this rule?
p {
text-align: center;
font-weight: bold;
} (a) 300px (b) bold (c) font-weight (d) 2px solid -
32.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 20px;
}
} -
33.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 34.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
- 35.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <link> (d) <a>
-
36.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 20px;
border: 3px solid black;
margin: 5px;
} -
37.🎯 Which CSS selector matches this element?
<p class="box" id="end">Hello</p> (a) p (b) #box (c) #hero (d) .end - 38.📦 In the box model, which part is the gap round content? (a) padding (b) content (c) border (d) margin
- 39.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
-
40.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
margin: 10px;
}
Answer key
- fits every screen
- color
- .note
- .note
- red
- puts boxes in the middle
- red
- False
- puts a picture on a page
- green
- purple
- 142
- space-between
- font-family
- #top
- 8px
- 600px or narrower
- #
- the text or picture
- green
- 18
- flex-direction
- 12
- 138
- 104
- 242
- 20
- CSS
- equal gaps, none at ends
- 800px or wider
- bold
- 24
- 70
- packs boxes at the start
- <link>
- 356
- p
- padding
- ;
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids