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.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) center (d) space-between
-
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} - 3.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
-
4.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} -
5.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) Yes (b) No -
6.✍️ Which property is set to yellow in this rule?
li {
text-align: center;
background-color: yellow;
} (a) padding (b) background-color (c) yellow (d) margin -
7.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). -
8.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
.menu { color: green; }
.menu { color: yellow; } (a) green (b) orange (c) yellow (d) red - 9.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
- 10.Which of these does JavaScript do? (a) rounds box corners (b) shows a pop-up message (c) lays out the page (d) makes a form box
- 11.True or false: padding is the text or picture. (a) False (b) True
- 12.True or false: HTML makes headings and lists. (a) False (b) True
-
13.⚖️ What colour is the text of this element?
<h2 class="star" id="main">Hi</h2>
CSS:
h2 { color: white; }
#main { color: yellow; }
.star { color: red; } (a) white (b) red (c) black (d) yellow -
14.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
#hero { color: green; }
p { color: orange; } (a) yellow (b) green (c) blue (d) orange -
15.🖌️ What colour is behind the letters?
h1 {
font-size: 20px;
color: yellow;
background-color: orange;
text-align: right;
} (a) yellow (b) orange (c) green - 16.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
- 17.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
- 18.True or false: the content is the line round the box. (a) True (b) False
- 19.🌈 Which colour is #00ffff? (a) bright green (b) blue (c) black (d) cyan
- 20.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
-
21.✍️ What is the selector in this CSS rule?
h2 {
border: 2px solid;
width: 300px;
} (a) border (b) h1 (c) 300px (d) h2 -
22.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} - 23.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) makes the text bold
- 24.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
- 25.🎯 Which element does the selector h1 style? (a) <li class="red"> (b) <h2> (c) <div id="hero"> (d) <h1 class="red">
- 26.What does font-size do? (a) sets the letter colour (b) makes the text bold (c) makes letters bigger (d) centres a heading
- 27.🌈 In #210000 the red part is the hex number 21. What is it as a normal number?
- 28.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
-
29.🖌️ What colour is behind the letters?
h2 {
background-color: orange;
color: black;
font-size: 24px;
text-align: right;
} (a) blue (b) orange (c) black - 30.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) align-items (d) display: flex
- 31.🌈 In #00009d the blue part is the hex number 9d. What is it as a normal number?
- 32.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 34.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-weight (d) font-size
- 35.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
- 36.🔍 Which is the odd one out? (a) changes the page live (b) gives the page structure (c) shows a pop-up message (d) checks a quiz answer
-
37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 15px;
border: 3px solid black;
margin: 20px;
} - 38.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
-
39.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
#end { color: green; }
#end { color: purple; } (a) yellow (b) blue (c) green (d) purple - 40.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) background-color (d) font-family
Answer key
- space-between
- 254
- CSS
- 24
- No
- background-color
- 10
- yellow
- blue
- shows a pop-up message
- False
- True
- yellow
- green
- orange
- 600px or narrower
- fits every screen
- False
- cyan
- HTML
- h2
- 24
- makes the text bold
- packs boxes at the start
- <h1 class="red">
- makes letters bigger
- 33
- the later one
- orange
- flex-direction
- 157
- Cascading Style Sheets
- 224
- background-color
- color
- gives the page structure
- 186
- ;
- purple
- font-size
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids