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: 270px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 2.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
-
3.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 4.🌈 Which colour is rgb(0, 0, 255)? (a) white (b) red (c) blue (d) yellow
-
5.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 260px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). - 6.🖌️ Which CSS property makes the text bold? (a) color (b) background-color (c) font-weight (d) font-size
-
7.✍️ What is the selector in this CSS rule?
h1 {
padding: 8px;
font-size: 20px;
margin: 10px;
} (a) padding (b) p (c) 20px (d) h1 - 8.Which of these does HTML do? (a) changes the text size (b) counts down a timer (c) makes a link (d) adds space around boxes
- 9.True or false: li is an element selector. (a) True (b) False
- 10.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the hr tag (d) the viewport meta tag
- 11.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
- 12.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) padding (d) border
- 13.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
-
14.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 330px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). -
15.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: red; } (a) yellow (b) red (c) blue (d) white - 16.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
-
17.⚖️ What colour is the text of this element?
<h2 class="box" id="top">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: orange; } (a) purple (b) white (c) orange (d) red -
18.✍️ Which property is set to 300px in this rule?
.box {
border: 2px solid;
width: 300px;
text-align: center;
} (a) width (b) color (c) font-style (d) 300px -
19.🎯 Which CSS selector matches this element?
<h2 class="red" id="logo">Hello</h2> (a) #red (b) .logo (c) h2 (d) #end -
20.🖌️ What colour are the letters?
h1 {
font-size: 24px;
text-align: right;
color: white;
background-color: orange;
} (a) orange (b) red (c) white -
21.🖌️ How big is the text, in px?
p {
background-color: orange;
text-align: center;
font-size: 36px;
color: purple;
} - 22.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
- 23.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) color (d) font-family
-
24.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
.star { color: blue; }
#logo { color: red; }
p { color: yellow; } (a) yellow (b) green (c) red (d) blue - 25.Which of these does HTML do? (a) adds space around boxes (b) checks a quiz answer (c) counts down a timer (d) puts a picture on a page
- 26.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
- 27.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2
- 28.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) text-align (d) color
- 29.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
-
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 350px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). - 31.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
- 32.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
- 33.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
- 34.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) font-size (d) color
-
35.🖌️ What colour are the letters?
li {
font-size: 16px;
text-align: right;
background-color: green;
color: red;
} (a) green (b) black (c) red -
36.🖌️ What colour is behind the letters?
li {
color: black;
background-color: purple;
text-align: center;
font-size: 12px;
} (a) black (b) blue (c) purple -
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} -
38.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 39.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
-
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins).
Answer key
- 368
- a class selector
- No
- blue
- 60
- font-weight
- h1
- makes a link
- True
- the viewport meta tag
- <link>
- margin
- ;
- 30
- red
- red
- orange
- width
- h2
- white
- 36
- space-between
- font-family
- red
- puts a picture on a page
- CSS
- 1
- text-align
- HTML
- 50
- HTML
- Cascading Style Sheets
- HTML
- color
- red
- purple
- 64
- Yes
- an id selector
- 50
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids