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: 260px;
justify-content: center;
}
Inside are 2 boxes, each 80px wide (no margins). - 2.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
- 3.🌈 Which colour is rgb(0, 0, 0)? (a) bright green (b) red (c) white (d) black
-
4.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 25px;
border: 5px solid black;
margin: 15px;
} -
5.🎯 Which CSS selector matches this element?
<div class="big" id="top">Hello</div> (a) span (b) .top (c) .big (d) .red -
6.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
p { color: blue; }
p { color: green; } (a) white (b) green (c) blue (d) yellow - 7.True or false: .star is a class selector. (a) False (b) True
-
8.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
.big { color: white; }
.big { color: red; } (a) purple (b) white (c) orange (d) red -
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 190px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} - 10.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) blue (d) green
-
11.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-style: italic;
text-align: center;
} - 12.True or false: HTML makes a form box. (a) False (b) True
- 13.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
-
14.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
#top { color: red; }
p { color: blue; }
.box { color: orange; } (a) blue (b) red (c) orange (d) white - 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) space-between (d) flex-end
- 16.🎯 What kind of selector is #hero? (a) a class selector (b) an element selector (c) an id selector
-
17.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} - 18.True or false: the border is the gap round content. (a) False (b) True
- 19.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
- 20.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) color (d) font-weight
- 21.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
-
22.🎯 Which CSS selector matches this element?
<div class="note" id="top">Hello</div> (a) #top (b) span (c) #intro (d) #note - 23.True or false: JavaScript makes a form box. (a) True (b) False
- 24.True or false: #main is a class selector. (a) False (b) True
-
25.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
.note { color: green; }
.note { color: blue; } (a) purple (b) green (c) orange (d) blue -
26.🎯 Which CSS selector matches this element?
<div class="box" id="top">Hello</div> (a) .star (b) span (c) .box (d) #box - 27.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) space outside the border (d) the gap round content
- 28.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
- 29.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-weight (c) color (d) text-align
- 30.Which of these does HTML do? (a) lays out the page (b) changes the page live (c) puts a picture on a page (d) reacts to a button click
- 31.Which of these is margin? (a) the gap round content (b) space inside the border (c) the gap to other boxes (d) a solid or dotted edge
-
32.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
#top { color: yellow; }
h1 { color: blue; } (a) red (b) yellow (c) blue (d) black - 33.🎯 Which sign starts an id selector? (a) @ (b) & (c) # (d) .
-
34.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 10px;
border: 4px solid black;
margin: 0px;
} -
35.🖌️ Where does the text sit on its line?
h2 {
font-size: 28px;
text-align: left;
color: red;
background-color: orange;
} (a) in the middle (b) on the left (c) on the right -
36.✍️ Which property is set to 20px in this rule?
.box {
text-align: center;
font-size: 20px;
} (a) text-align (b) background-color (c) 20px (d) font-size -
37.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 340px;
justify-content: space-between;
}
Inside are 3 boxes, each 60px wide (no margins). - 38.🌈 Which colour is rgb(0, 0, 255)? (a) white (b) red (c) magenta (d) blue
- 39.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) border (d) content
- 40.🌈 Which hex code is red? (a) #00ffff (b) #000000 (c) #ff0000 (d) #00ff00
Answer key
- 50
- :
- black
- 230
- .big
- green
- True
- red
- 296
- red
- 2
- True
- the later one
- red
- center
- an id selector
- 20
- False
- /*
- font-size
- <style>
- #top
- False
- False
- blue
- .box
- space outside the border
- Cascading Style Sheets
- color
- puts a picture on a page
- the gap to other boxes
- yellow
- #
- 248
- on the left
- font-size
- 80
- blue
- content
- #ff0000
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids