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 is the selector in this CSS rule?
p {
font-weight: bold;
border: 2px solid;
} (a) .note (b) font-weight (c) p (d) 2px solid -
2.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 420px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). - 3.Which of these is padding? (a) the gap round content (b) space outside the border (c) the gap to other boxes (d) a solid or dotted edge
- 4.True or false: padding is space inside the border. (a) True (b) False
- 5.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) 2 (d) any number
-
6.✍️ Which property is set to yellow in this rule?
h1 {
border: 2px solid;
color: red;
background-color: yellow;
font-style: italic;
} (a) yellow (b) padding (c) margin (d) background-color - 7.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
-
8.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 420px;
justify-content: center;
}
Inside are 4 boxes, each 80px wide (no margins). -
9.🖌️ How big is the text, in px?
h1 {
font-size: 28px;
color: black;
background-color: yellow;
text-align: right;
} - 10.🌈 Which colour of light is strongest in rgb(89, 70, 169)? (a) green (b) blue (c) red
-
11.✍️ What is the selector in this CSS rule?
body {
margin: 10px;
background-color: yellow;
color: red;
} (a) yellow (b) .box (c) body (d) margin -
12.🖌️ How big is the text, in px?
h2 {
background-color: black;
color: yellow;
font-size: 28px;
text-align: left;
} -
13.🖌️ Where does the text sit on its line?
p {
color: yellow;
font-size: 16px;
background-color: blue;
text-align: right;
} (a) in the middle (b) on the right (c) on the left - 14.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) blue (c) black (d) magenta
-
15.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 16.✍️ In color: blue; which part is the property? (a) : (b) ; (c) blue (d) color
- 17.🌈 In #003d00 the green part is the hex number 3d. What is it as a normal number?
- 18.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
- 19.🌈 Which colour is #00ff00? (a) bright green (b) magenta (c) red (d) yellow
-
20.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 460px;
justify-content: flex-start;
}
Inside are 4 boxes, each 100px wide (no margins). - 21.🌈 Which hex code is black? (a) #ffff00 (b) #0000ff (c) #000000 (d) #00ff00
- 22.🔍 Which is the odd one out? (a) reacts to a button click (b) puts a picture on a page (c) shows a pop-up message (d) changes the page live
- 23.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
-
24.🖌️ Where does the text sit on its line?
h2 {
text-align: left;
font-size: 24px;
color: green;
background-color: red;
} (a) on the left (b) in the middle (c) on the right - 25.Which of these does CSS do? (a) shows a pop-up message (b) changes the page live (c) makes a form box (d) sets colours and fonts
-
26.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
27.✍️ What value is given to font-weight in this rule?
h2 {
font-weight: bold;
padding: 8px;
color: red;
} (a) 300px (b) bold (c) 2px solid (d) font-weight - 28.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
-
29.🎯 Which CSS selector matches this element?
<h1 class="note" id="intro">Hello</h1> (a) h1 (b) #note (c) h2 (d) .intro - 30.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) the gap round content (d) space inside the border
-
31.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-style: italic;
margin: 10px;
font-size: 20px;
} - 32.Which of these does CSS do? (a) makes a form box (b) changes the page live (c) makes headings and lists (d) adds space around boxes
- 33.True or false: CSS puts a picture on a page. (a) True (b) False
- 34.Which of these does HTML do? (a) counts down a timer (b) rounds box corners (c) changes the page live (d) makes a form box
-
35.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
} - 36.🎯 Which element does the selector #logo style? (a) <h1 class="logo"> (b) <h1 id="logo"> (c) <h1 id="end"> (d) <h2 class="menu">
-
37.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-weight: bold;
text-align: center;
} - 38.🎯 What kind of selector is .menu? (a) a class selector (b) an id selector (c) an element selector
- 39.🌈 Which colour is #ff00ff? (a) cyan (b) black (c) magenta (d) blue
- 40.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
Answer key
- p
- 60
- the gap round content
- True
- 1
- background-color
- /*
- 50
- 28
- blue
- body
- 28
- on the right
- blue
- No
- color
- 61
- a class selector
- bright green
- 60
- #000000
- puts a picture on a page
- CSS
- on the left
- sets colours and fonts
- 16
- bold
- border
- h1
- the gap to other boxes
- 3
- adds space around boxes
- False
- makes a form box
- 1
- <h1 id="logo">
- 2
- a class selector
- magenta
- F
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids