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.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
- 2.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
- 3.True or false: img is an element selector. (a) False (b) True
-
4.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) Yes (b) No -
5.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} - 6.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the hr tag (d) the br tag
-
7.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). -
8.🖌️ Where does the text sit on its line?
li {
text-align: right;
background-color: green;
color: white;
font-size: 12px;
} (a) on the right (b) on the left (c) in the middle -
9.✍️ What is the selector in this CSS rule?
h2 {
border: 2px solid;
background-color: yellow;
} (a) yellow (b) h2 (c) h1 (d) border - 10.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="note"> (c) <h2 class="note"> (d) <span id="logo">
- 11.📦 In the box model, which part is the gap round content? (a) padding (b) border (c) content (d) margin
- 12.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
-
13.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 20px;
border: 1px solid black;
margin: 20px;
} - 14.✍️ In color: blue; which part is the property? (a) ; (b) : (c) blue (d) color
-
15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 230px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} -
16.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 6px;
}
} (a) Yes (b) No -
17.⚖️ What colour is the text of this element?
<h2 class="red" id="top">Hi</h2>
CSS:
.red { color: blue; }
.red { color: white; } (a) black (b) blue (c) white (d) red - 18.True or false: li is an id selector. (a) True (b) False
- 19.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
-
20.🖌️ How big is the text, in px?
h2 {
text-align: left;
background-color: purple;
font-size: 28px;
color: white;
} -
21.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
.star { color: red; }
.star { color: orange; } (a) white (b) orange (c) blue (d) red -
22.✍️ What is the selector in this CSS rule?
h1 {
padding: 8px;
font-weight: bold;
width: 300px;
} (a) padding (b) h1 (c) bold (d) p -
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 24.🔍 Which is the odd one out? (a) rounds box corners (b) lays out the page (c) counts down a timer (d) adds space around boxes
-
25.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 26.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
-
27.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
.star { color: yellow; }
h1 { color: white; } (a) green (b) red (c) white (d) yellow - 28.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
- 29.🌈 In #003b00 the green part is the hex number 3b. What is it as a normal number?
- 30.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) flex-start (d) center
- 31.True or false: #top is an id selector. (a) False (b) True
- 32.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) < > (d) { }
- 33.🖌️ Which CSS property colours behind the text? (a) font-weight (b) color (c) text-align (d) background-color
- 34.Which of these does HTML do? (a) adds space around boxes (b) changes the text size (c) makes a link (d) checks a quiz answer
-
35.✍️ How many declarations (property: value pairs) are in this rule?
li {
border: 2px solid;
} -
36.✍️ What is the selector in this CSS rule?
p {
margin: 10px;
padding: 8px;
color: red;
border: 2px solid;
} (a) margin (b) p (c) .note (d) 8px - 37.What does font-size do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) makes the text bold
- 38.🌈 Which colour of light is strongest in rgb(210, 49, 127)? (a) blue (b) red (c) green
- 39.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 40.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
Answer key
- 800px or wider
- packs boxes at the start
- True
- No
- 220
- the viewport meta tag
- 30
- on the right
- h2
- <h2 class="note">
- padding
- fits every screen
- 252
- color
- 294
- Yes
- white
- False
- many pages
- 28
- orange
- h1
- 226
- counts down a timer
- No
- 255
- yellow
- blue
- 59
- flex-end
- True
- { }
- background-color
- makes a link
- 1
- p
- makes letters bigger
- red
- an id selector
- center
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids