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.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
.box { color: white; }
p { color: green; } (a) orange (b) red (c) white (d) green -
2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 80px;
padding: 25px;
border: 4px solid black;
margin: 10px;
} - 3.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
- 4.What does justify-content: flex-start do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
- 5.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
-
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 7.🌈 In #00c500 the green part is the hex number c5. What is it as a normal number?
- 8.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) margin (d) content
- 9.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 170px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 11.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) magenta (d) bright green
- 12.🎯 Which element does the selector p style? (a) <li id="end"> (b) <h2 class="box"> (c) <p class="box"> (d) <h1>
- 13.Which of these is padding? (a) space outside the border (b) the text or picture (c) the gap round content (d) the line round the box
-
14.🖌️ How big is the text, in px?
li {
color: white;
font-size: 36px;
background-color: red;
text-align: left;
} - 15.True or false: HTML rounds box corners. (a) True (b) False
-
16.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
#intro { color: orange; }
.menu { color: purple; }
p { color: green; } (a) orange (b) blue (c) green (d) purple - 17.🔍 Which is the odd one out? (a) puts a picture on a page (b) reacts to a button click (c) makes headings and lists (d) gives the page structure
- 18.🎯 Which element does the selector .box style? (a) <p class="box"> (b) <h1 class="menu"> (c) <p id="box"> (d) <p class="star">
- 19.🎯 Which element does the selector #logo style? (a) <h1 class="logo"> (b) <h1 id="end"> (c) <h2 class="box"> (d) <h1 id="logo">
- 20.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) red (c) blue (d) white
-
21.✍️ Which property is set to 300px in this rule?
li {
width: 300px;
font-style: italic;
} (a) 300px (b) color (c) font-style (d) width - 22.✍️ Which sign goes between a property and its value? (a) - (b) : (c) = (d) ;
- 23.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) J (c) Z (d) G
- 24.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
- 25.🌈 In #004100 the green part is the hex number 41. What is it as a normal number?
-
26.🖌️ Where does the text sit on its line?
li {
text-align: left;
background-color: green;
font-size: 36px;
color: purple;
} (a) in the middle (b) on the right (c) on the left -
27.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
p { color: purple; }
p { color: green; } (a) yellow (b) blue (c) purple (d) green - 28.True or false: margin is the gap round content. (a) False (b) True
-
29.🖌️ What colour are the letters?
li {
color: black;
background-color: blue;
text-align: right;
font-size: 40px;
} (a) black (b) blue (c) green -
30.🖌️ Where does the text sit on its line?
li {
color: black;
font-size: 32px;
text-align: right;
background-color: green;
} (a) on the left (b) in the middle (c) on the right - 31.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
-
32.🖌️ What colour are the letters?
h2 {
text-align: right;
font-size: 20px;
background-color: orange;
color: green;
} (a) purple (b) orange (c) green - 33.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
- 34.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) any number (d) 1
- 35.🖌️ Which CSS property centres a heading? (a) font-size (b) font-family (c) text-align (d) color
- 36.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
- 37.🌈 Which colour of light is strongest in rgb(125, 105, 211)? (a) green (b) blue (c) red
- 38.What does font-weight do? (a) picks the font style (b) makes letters bigger (c) centres a heading (d) makes the text bold
- 39.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
- 40.Which of these does CSS do? (a) lays out the page (b) makes a link (c) makes headings and lists (d) reacts to a button click
Answer key
- white
- 138
- packs boxes at the end
- packs boxes at the start
- JavaScript
- 108
- 197
- padding
- blue
- 232
- red
- <p class="box">
- the gap round content
- 36
- False
- orange
- reacts to a button click
- <p class="box">
- <h1 id="logo">
- white
- width
- :
- F
- blue
- 65
- on the left
- green
- False
- black
- on the right
- padding
- green
- the screen width
- 1
- text-align
- color
- blue
- makes the text bold
- 600px or narrower
- lays out the page
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids