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="big" id="intro">Hi</p>
CSS:
#intro { color: blue; }
#intro { color: red; } (a) green (b) blue (c) red (d) black - 2.Which of these does JavaScript do? (a) makes a link (b) gives the page structure (c) changes the page live (d) lays out the page
- 3.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) flex-start (d) center
- 4.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
- 5.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
-
6.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). - 7.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) never changes (d) fits every screen
-
8.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} - 9.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
- 10.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) background-color
-
11.🎯 Which CSS selector matches this element?
<h1 class="menu" id="intro">Hello</h1> (a) h2 (b) h1 (c) #main (d) .note - 12.🖌️ Which CSS property centres a heading? (a) font-size (b) font-weight (c) background-color (d) text-align
-
13.🖌️ How big is the text, in px?
li {
color: red;
background-color: yellow;
font-size: 28px;
text-align: right;
} -
14.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-weight: bold;
width: 300px;
background-color: yellow;
} - 15.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
- 16.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
- 17.🎯 Which element does the selector h1 style? (a) <div id="top"> (b) <li class="note"> (c) <h1 class="note"> (d) <h2>
- 18.Which of these is margin? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the gap round content
- 19.📦 In the box model, which part is the text or picture? (a) margin (b) padding (c) content (d) border
-
20.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
border: 2px solid;
margin: 10px;
} -
21.🎯 Which CSS selector matches this element?
<h2 class="star" id="top">Hello</h2> (a) .menu (b) #star (c) .top (d) #top - 22.🌈 In #002e00 the green part is the hex number 2e. What is it as a normal number?
-
23.✍️ What is the selector in this CSS rule?
body {
background-color: yellow;
border: 2px solid;
padding: 8px;
} (a) body (b) 2px solid (c) background-color (d) .box - 24.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) picks the font style (d) makes letters bigger
- 25.🔍 Which is the odd one out? (a) puts a picture on a page (b) changes the text size (c) makes a form box (d) makes a link
-
26.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
margin: 10px;
border: 2px solid;
color: red;
} - 27.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
- 28.True or false: margin is space outside the border. (a) False (b) True
-
29.⚖️ What colour is the text of this element?
<h2 class="box" id="hero">Hi</h2>
CSS:
#hero { color: white; }
#hero { color: orange; } (a) white (b) yellow (c) orange (d) black - 30.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) text-align (d) color
- 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) F (d) Z
-
32.🖌️ What colour are the letters?
p {
color: black;
font-size: 12px;
text-align: center;
background-color: white;
} (a) white (b) red (c) black - 33.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) red (c) magenta (d) blue
-
34.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
.note { color: white; }
.note { color: red; } (a) yellow (b) purple (c) red (d) white - 35.True or false: .big is an id selector. (a) False (b) True
- 36.🔍 Which is the odd one out? (a) makes a form box (b) adds space around boxes (c) changes the text size (d) lays out the page
-
37.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). - 38.🎯 Can many elements share the same class? (a) No (b) Yes
-
39.🖌️ How big is the text, in px?
li {
text-align: left;
font-size: 20px;
color: white;
background-color: purple;
} -
40.🖌️ What colour is behind the letters?
h1 {
font-size: 40px;
color: green;
text-align: right;
background-color: purple;
} (a) green (b) yellow (c) purple
Answer key
- red
- changes the page live
- center
- CSS
- 137
- 20
- fits every screen
- 18
- 600px or narrower
- font-family
- h1
- text-align
- 28
- 3
- { }
- CSS
- <h1 class="note">
- the gap to other boxes
- content
- 2
- #top
- 46
- body
- makes letters bigger
- changes the text size
- 3
- the screen width
- True
- orange
- background-color
- F
- black
- red
- red
- False
- makes a form box
- 40
- Yes
- 20
- purple
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids