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: 140px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). - 2.🌈 In #003800 the green part is the hex number 38. What is it as a normal number?
-
3.🖌️ How big is the text, in px?
li {
text-align: left;
font-size: 16px;
background-color: purple;
color: orange;
} -
4.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 270px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). - 5.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) color (c) background-color (d) font-family
- 6.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) yellow (c) bright green (d) cyan
- 7.🎯 Which element does the selector h1 style? (a) <li class="box"> (b) <h1 class="box"> (c) <h2> (d) <div id="end">
-
8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 270px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} - 9.True or false: HTML gives the page structure. (a) False (b) True
- 10.What does text-align do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
- 11.Which of these does CSS do? (a) reacts to a button click (b) makes headings and lists (c) counts down a timer (d) rounds box corners
- 12.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) colours behind the text
- 13.True or false: HTML counts down a timer. (a) False (b) True
-
14.✍️ What value is given to background-color in this rule?
body {
font-size: 20px;
background-color: yellow;
} (a) 8px (b) background-color (c) 10px (d) yellow - 15.🎯 Which element does the selector .box style? (a) <h2 class="star"> (b) <h2 class="box"> (c) <li class="menu"> (d) <h2 id="box">
-
16.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
.big { color: green; }
.big { color: white; } (a) yellow (b) white (c) orange (d) green - 17.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
- 18.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-end (c) flex-start (d) space-between
- 19.🎯 Which element does the selector span style? (a) <p> (b) <h2 id="hero"> (c) <h1 class="menu"> (d) <span class="menu">
- 20.📱 What does a media query check? (a) the battery level (b) the screen width (c) the time of day (d) the page title
- 21.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
- 22.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 4 (d) 3
-
23.🖌️ Where does the text sit on its line?
h1 {
background-color: black;
color: white;
font-size: 20px;
text-align: left;
} (a) in the middle (b) on the right (c) on the left - 24.🖌️ Which CSS property centres a heading? (a) text-align (b) background-color (c) font-weight (d) font-size
- 25.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
-
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 27.Which of these is padding? (a) the gap to other boxes (b) space outside the border (c) a solid or dotted edge (d) the gap round content
- 28.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
-
29.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). - 30.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-family (d) font-size
- 31.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) black (c) blue (d) white
- 32.🌈 Which colour is #000000? (a) black (b) blue (c) bright green (d) yellow
-
33.🖌️ How big is the text, in px?
h1 {
font-size: 32px;
text-align: right;
background-color: red;
color: white;
} - 34.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
- 35.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
-
36.✍️ Which property is set to 2px solid in this rule?
h2 {
text-align: center;
border: 2px solid;
} (a) 2px solid (b) font-style (c) width (d) border -
37.🖌️ What colour are the letters?
h1 {
background-color: green;
font-size: 28px;
text-align: right;
color: black;
} (a) black (b) green (c) orange -
38.⚖️ What colour is the text of this element?
<p class="big" id="end">Hi</p>
CSS:
p { color: yellow; }
#end { color: black; } (a) purple (b) blue (c) black (d) yellow -
39.🖌️ What colour are the letters?
li {
background-color: green;
font-size: 32px;
color: blue;
text-align: right;
} (a) green (b) yellow (c) blue - 40.True or false: the border is the gap round content. (a) True (b) False
Answer key
- 20
- 56
- 16
- 30
- color
- bright green
- <h1 class="box">
- 286
- True
- centres a heading
- rounds box corners
- makes the text bold
- False
- yellow
- <h2 class="box">
- white
- 600px or narrower
- center
- <span class="menu">
- the screen width
- ;
- 3
- on the left
- text-align
- an element selector
- 262
- the gap round content
- a class selector
- 60
- font-family
- black
- black
- 32
- red
- <link>
- border
- black
- black
- blue
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids