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 empty space (px) is before the first box?
.row {
display: flex;
width: 220px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). - 2.What does font-weight do? (a) centres a heading (b) makes the text bold (c) picks the font style (d) sets the letter colour
-
3.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
4.✍️ What value is given to width in this rule?
.box {
width: 300px;
font-weight: bold;
font-size: 20px;
padding: 8px;
} (a) width (b) 300px (c) red (d) italic -
5.🖌️ What colour are the letters?
p {
background-color: green;
color: white;
font-size: 40px;
text-align: right;
} (a) green (b) white (c) blue - 6.What does background-color do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
- 7.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) flex-end (d) space-between
-
8.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
.red { color: red; }
.red { color: green; } (a) black (b) red (c) green (d) purple -
9.✍️ Which property is set to yellow in this rule?
h1 {
background-color: yellow;
width: 300px;
} (a) yellow (b) margin (c) padding (d) background-color - 10.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
- 11.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
- 12.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
- 13.🌈 Which hex code is bright green? (a) #ff0000 (b) #ffffff (c) #00ff00 (d) #0000ff
-
14.✍️ What value is given to font-size in this rule?
#top {
font-style: italic;
font-size: 20px;
font-weight: bold;
} (a) 20px (b) yellow (c) font-size (d) center - 15.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
-
16.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 110px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 17.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
-
18.🖌️ What colour are the letters?
li {
background-color: green;
color: white;
font-size: 36px;
text-align: right;
} (a) white (b) green (c) blue - 19.🌈 Which colour of light is strongest in rgb(17, 82, 196)? (a) red (b) blue (c) green
- 20.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
- 21.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
-
22.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
p { color: black; }
.red { color: orange; } (a) black (b) red (c) yellow (d) orange -
23.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} (a) Yes (b) No -
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 260px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). - 25.🌈 Which hex code is white? (a) #ffff00 (b) #ffffff (c) #ff00ff (d) #0000ff
- 26.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
- 27.Which of these does HTML do? (a) lays out the page (b) shows a pop-up message (c) puts a picture on a page (d) rounds box corners
- 28.🌈 In #00000a the blue part is the hex number 0a. What is it as a normal number?
- 29.Which of these does JavaScript do? (a) changes the text size (b) reacts to a button click (c) puts a picture on a page (d) makes headings and lists
- 30.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) centres a heading (d) picks the font style
- 31.True or false: CSS makes a link. (a) False (b) True
-
32.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} - 33.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
-
34.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
.menu { color: black; }
p { color: green; } (a) blue (b) green (c) black (d) white - 35.🌈 Which colour of light is strongest in rgb(198, 31, 26)? (a) green (b) blue (c) red
- 36.True or false: the border is a solid or dotted edge. (a) True (b) False
-
37.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 170px;
justify-content: flex-end;
}
Inside are 2 boxes, each 80px wide (no margins). -
38.🖌️ What colour are the letters?
p {
color: orange;
text-align: right;
font-size: 16px;
background-color: purple;
} (a) purple (b) green (c) orange -
39.🎯 Which CSS selector matches this element?
<p class="box" id="logo">Hello</p> (a) #box (b) #end (c) h1 (d) .box -
40.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 32px;
}
} (a) No (b) Yes
Answer key
- 50
- makes the text bold
- Yes
- 300px
- white
- colours behind the text
- flex-start
- green
- background-color
- :
- an id selector
- packs boxes at the start
- #00ff00
- 20px
- Cascading Style Sheets
- 10
- many pages
- white
- blue
- CSS
- HTML
- orange
- No
- 20
- #ffffff
- 800px or wider
- puts a picture on a page
- 10
- reacts to a button click
- picks the font style
- False
- 18
- CSS
- black
- red
- True
- 10
- orange
- .box
- No
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids