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.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
- 2.True or false: CSS checks a quiz answer. (a) True (b) False
- 3.🎯 How many elements on a page should have the same id? (a) any number (b) 5 (c) 1 (d) 2
-
4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 90px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 5.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
- 6.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) magenta (c) white (d) yellow
- 7.🌈 Which colour is rgb(0, 255, 255)? (a) blue (b) cyan (c) bright green (d) yellow
- 8.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 9.🌈 Which colour of light is strongest in rgb(174, 65, 88)? (a) red (b) green (c) blue
- 10.🎯 Which sign starts a class selector? (a) @ (b) # (c) . (d) &
- 11.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
-
12.✍️ Which property is set to italic in this rule?
.box {
background-color: yellow;
font-style: italic;
} (a) font-style (b) font-size (c) color (d) italic -
13.✍️ How many declarations (property: value pairs) are in this rule?
.note {
margin: 10px;
font-style: italic;
color: red;
background-color: yellow;
} - 14.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
- 15.True or false: CSS makes a form box. (a) False (b) True
-
16.🖌️ What colour are the letters?
h1 {
background-color: red;
color: black;
font-size: 36px;
text-align: center;
} (a) black (b) purple (c) red -
17.✍️ What is the selector in this CSS rule?
.box {
margin: 10px;
border: 2px solid;
background-color: yellow;
} (a) h2 (b) .box (c) margin (d) 2px solid -
18.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
p { color: red; }
#intro { color: blue; }
.menu { color: yellow; } (a) yellow (b) red (c) black (d) blue - 19.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <css> (d) <script>
- 20.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) space-between (d) flex-end
-
21.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 22.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) display: flex (c) justify-content (d) flex-direction
-
23.🎯 Which CSS selector matches this element?
<div class="box" id="end">Hello</div> (a) .box (b) span (c) #hero (d) #box - 24.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the first one (d) the later one
-
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 540px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). -
26.🖌️ Where does the text sit on its line?
h1 {
color: blue;
background-color: yellow;
text-align: center;
font-size: 12px;
} (a) on the right (b) on the left (c) in the middle - 27.True or false: CSS shows a pop-up message. (a) True (b) False
- 28.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
-
29.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 190px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). -
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 90px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). -
31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 32.🌈 Which colour is #000000? (a) bright green (b) magenta (c) white (d) black
- 33.Which of these does HTML do? (a) changes the text size (b) reacts to a button click (c) rounds box corners (d) puts a picture on a page
- 34.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
- 35.True or false: img is an id selector. (a) False (b) True
-
36.🖌️ What colour is behind the letters?
li {
background-color: black;
text-align: right;
color: purple;
font-size: 12px;
} (a) black (b) purple (c) red - 37.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) # (d) //
- 38.🌈 Which hex code is black? (a) #00ff00 (b) #ffff00 (c) #000000 (d) #ffffff
- 39.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
- 40.🖌️ Which CSS property picks the font style? (a) font-size (b) font-weight (c) font-family (d) background-color
Answer key
- border
- False
- 1
- 116
- CSS
- magenta
- cyan
- an id selector
- red
- .
- an element selector
- font-style
- 4
- fits every screen
- False
- black
- .box
- blue
- <style>
- flex-start
- Yes
- justify-content
- .box
- the later one
- 70
- in the middle
- False
- 3
- 30
- 10
- 326
- black
- puts a picture on a page
- margin
- False
- black
- /*
- #000000
- #
- font-family
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids