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 language rounds box corners? (a) CSS (b) HTML (c) JavaScript
-
2.⚖️ What colour is the text of this element?
<h1 class="menu" id="end">Hi</h1>
CSS:
.menu { color: blue; }
h1 { color: orange; } (a) orange (b) yellow (c) blue (d) black -
3.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
#intro { color: white; }
#intro { color: orange; } (a) yellow (b) white (c) red (d) orange - 4.What does justify-content: space-between 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
- 5.True or false: padding is the gap round content. (a) False (b) True
-
6.🖌️ How big is the text, in px?
h2 {
color: blue;
font-size: 40px;
background-color: red;
text-align: center;
} - 7.🌈 Which colour is #ff00ff? (a) yellow (b) cyan (c) white (d) magenta
- 8.🎯 Which element does the selector .star style? (a) <h1 class="star"> (b) <h1 id="star"> (c) <h1 class="menu"> (d) <h2 class="note">
- 9.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) shows a pop-up message (d) adds space around boxes
- 10.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
- 11.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
-
12.✍️ Which property is set to 2px solid in this rule?
#top {
font-size: 20px;
border: 2px solid;
} (a) border (b) width (c) font-style (d) 2px solid - 13.🌈 Which colour of light is strongest in rgb(94, 212, 70)? (a) red (b) blue (c) green
- 14.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red
- 15.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) flex-start (d) center
-
16.✍️ What value is given to width in this rule?
h1 {
color: red;
width: 300px;
font-weight: bold;
font-size: 20px;
} (a) width (b) italic (c) red (d) 300px - 17.🎯 Can many elements share the same class? (a) Yes (b) No
- 18.What does font-family do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) picks the font style
- 19.🌈 Which hex code is cyan? (a) #ffffff (b) #ff0000 (c) #0000ff (d) #00ffff
-
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
21.✍️ What is the selector in this CSS rule?
.note {
border: 2px solid;
padding: 8px;
color: red;
background-color: yellow;
} (a) border (b) #top (c) 8px (d) .note - 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
- 23.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
-
24.✍️ What is the selector in this CSS rule?
#top {
font-size: 20px;
background-color: yellow;
margin: 10px;
text-align: center;
} (a) li (b) #top (c) yellow (d) font-size -
25.🖌️ What colour are the letters?
p {
color: red;
background-color: purple;
text-align: left;
font-size: 20px;
} (a) red (b) purple (c) orange -
26.✍️ What value is given to color in this rule?
#top {
font-weight: bold;
color: red;
padding: 8px;
border: 2px solid;
} (a) center (b) color (c) 20px (d) red - 27.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the text size (c) rounds box corners (d) adds space around boxes
- 28.True or false: margin is a solid or dotted edge. (a) True (b) False
-
29.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
.star { color: orange; }
#end { color: yellow; } (a) orange (b) red (c) black (d) yellow - 30.True or false: CSS changes the text size. (a) False (b) True
-
31.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 130px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 32.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
- 33.🎯 Which element does the selector p style? (a) <li id="hero"> (b) <h2 class="box"> (c) <h1> (d) <p class="box">
- 34.🖌️ Which CSS property makes the text bold? (a) color (b) font-size (c) font-family (d) font-weight
- 35.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
- 36.🖌️ Which CSS property sets the letter colour? (a) text-align (b) background-color (c) color (d) font-weight
- 37.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
- 38.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 39.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
- 40.What does color do? (a) sets the letter colour (b) colours behind the text (c) centres a heading (d) makes the text bold
Answer key
- CSS
- blue
- orange
- equal gaps, none at ends
- True
- 40
- magenta
- <h1 class="star">
- puts a picture on a page
- the viewport meta tag
- 600px or narrower
- border
- green
- blue
- center
- 300px
- Yes
- picks the font style
- #00ffff
- 30
- .note
- the later one
- HTML
- #top
- red
- red
- makes headings and lists
- False
- yellow
- True
- 10
- fits every screen
- <p class="box">
- font-weight
- .css
- color
- JavaScript
- an element selector
- blue
- sets the letter colour
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids