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 space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 25px;
border: 5px solid black;
margin: 10px;
} -
2.🖌️ How big is the text, in px?
h1 {
background-color: black;
font-size: 32px;
text-align: center;
color: purple;
} - 3.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
- 4.🔍 Which is the odd one out? (a) sets colours and fonts (b) checks a quiz answer (c) adds space around boxes (d) rounds box corners
-
5.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 400px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). - 6.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
-
7.🎯 Which CSS selector matches this element?
<li class="red" id="end">Hello</li> (a) div (b) #red (c) #hero (d) li - 8.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
-
9.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 12px;
}
} - 10.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
-
11.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
p { color: green; }
.red { color: blue; }
#intro { color: yellow; } (a) green (b) blue (c) yellow (d) black -
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 13.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 6 (d) 4
- 14.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) centres a heading (d) colours behind the text
- 15.What does justify-content: center do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
- 16.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
-
17.✍️ Which property is set to bold in this rule?
.note {
border: 2px solid;
font-weight: bold;
width: 300px;
padding: 8px;
} (a) font-weight (b) width (c) border (d) bold -
18.✍️ Which property is set to red in this rule?
h1 {
margin: 10px;
border: 2px solid;
color: red;
font-style: italic;
} (a) font-size (b) color (c) text-align (d) red -
19.🖌️ What colour is behind the letters?
p {
font-size: 36px;
color: white;
text-align: right;
background-color: yellow;
} (a) yellow (b) purple (c) white - 20.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
- 21.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
- 22.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 23.🌈 In #780000 the red part is the hex number 78. What is it as a normal number?
- 24.True or false: #main is a class selector. (a) True (b) False
- 25.What does background-color do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) makes the text bold
-
26.🖌️ What colour is behind the letters?
li {
font-size: 40px;
background-color: blue;
color: red;
text-align: left;
} (a) blue (b) black (c) red - 27.True or false: padding is space outside the border. (a) True (b) False
- 28.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
- 29.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
- 30.🌈 Which colour is #00ffff? (a) blue (b) red (c) black (d) cyan
- 31.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) 5 (d) any number
- 32.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
- 33.True or false: HTML makes a form box. (a) True (b) False
- 34.True or false: JavaScript makes a link. (a) True (b) False
- 35.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
- 36.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
- 37.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) align-items (c) gap (d) flex-direction
-
38.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} (a) No (b) Yes -
39.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
#intro { color: blue; }
h1 { color: yellow; }
.note { color: green; } (a) blue (b) yellow (c) orange (d) green -
40.✍️ How many declarations (property: value pairs) are in this rule?
p {
margin: 10px;
border: 2px solid;
text-align: center;
}
Answer key
- 140
- 32
- blue
- checks a quiz answer
- 80
- 600px or narrower
- li
- gives the page structure
- 16
- color
- yellow
- 312
- 3
- centres a heading
- puts boxes in the middle
- center
- font-weight
- color
- yellow
- :
- HTML
- CSS
- 120
- False
- colours behind the text
- blue
- False
- the viewport meta tag
- packs boxes at the start
- cyan
- 1
- .
- True
- False
- flex-start
- red
- justify-content
- Yes
- blue
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids