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.📱 What does a media query check? (a) the screen width (b) the time of day (c) the page title (d) the battery level
- 2.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
-
3.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
#hero { color: red; }
#hero { color: black; } (a) black (b) purple (c) red (d) orange - 4.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the title tag (d) the br tag
- 5.🌈 Which colour is #00ffff? (a) cyan (b) black (c) blue (d) bright green
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 10px;
border: 2px solid black;
margin: 20px;
} - 7.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
-
8.✍️ Which property is set to 2px solid in this rule?
.note {
border: 2px solid;
text-align: center;
background-color: yellow;
} (a) font-style (b) width (c) 2px solid (d) border - 9.🎯 Which element does the selector h1 style? (a) <li class="red"> (b) <h1 class="red"> (c) <h2> (d) <div id="end">
- 10.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
-
11.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 30px;
border: 2px solid black;
margin: 10px;
} - 12.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
-
13.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 14.True or false: #logo is an id selector. (a) True (b) False
-
15.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 16.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
-
17.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
18.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 250px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). -
19.✍️ What value is given to margin in this rule?
.note {
width: 300px;
font-style: italic;
margin: 10px;
} (a) 8px (b) margin (c) 10px (d) bold -
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 21.🌈 In #00f400 the green part is the hex number f4. What is it as a normal number?
- 22.Which of these does JavaScript do? (a) rounds box corners (b) puts a picture on a page (c) checks a quiz answer (d) sets colours and fonts
- 23.💪 Which flexbox property sets space between boxes? (a) align-items (b) justify-content (c) gap (d) display: flex
- 24.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
-
25.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
border: 2px solid;
font-size: 20px;
background-color: yellow;
} - 26.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) justify-content (c) gap (d) flex-direction
-
27.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
#logo { color: green; }
#logo { color: white; } (a) white (b) green (c) orange (d) black - 28.🌈 Which colour is #000000? (a) red (b) white (c) black (d) blue
-
29.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-style: italic;
font-weight: bold;
padding: 8px;
font-size: 20px;
} - 30.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
- 31.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
-
32.💪 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). -
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 5px;
border: 4px solid black;
margin: 5px;
} -
34.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: flex-end;
}
Inside are 4 boxes, each 50px wide (no margins). -
35.🖌️ How big is the text, in px?
li {
text-align: center;
color: yellow;
font-size: 20px;
background-color: black;
} - 36.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) center (d) flex-start
-
37.✍️ What value is given to font-size in this rule?
#top {
border: 2px solid;
color: red;
font-style: italic;
font-size: 20px;
} (a) 20px (b) yellow (c) font-size (d) center -
38.✍️ What is the selector in this CSS rule?
h2 {
width: 300px;
color: red;
} (a) h1 (b) width (c) h2 (d) red - 39.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the shorter one (d) the first one
- 40.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) makes the text bold
Answer key
- the screen width
- an id selector
- black
- the viewport meta tag
- cyan
- 254
- JavaScript
- border
- <h1 class="red">
- an element selector
- 124
- 255
- 116
- True
- 70
- .
- Yes
- 10
- 10px
- 10
- 244
- checks a quiz answer
- gap
- Cascading Style Sheets
- 4
- justify-content
- white
- black
- 4
- packs boxes at the end
- color
- 70
- 168
- 80
- 20
- flex-end
- 20px
- h2
- the later one
- makes the text bold
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids