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 adds space around boxes? (a) HTML (b) JavaScript (c) CSS
- 2.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) color (d) font-size
-
3.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
.menu { color: red; }
h2 { color: yellow; }
#logo { color: purple; } (a) purple (b) red (c) white (d) yellow -
4.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 8px;
}
} (a) Yes (b) No - 5.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-family (d) font-weight
- 6.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
-
7.⚖️ What colour is the text of this element?
<h1 class="box" id="logo">Hi</h1>
CSS:
h1 { color: yellow; }
.box { color: black; } (a) blue (b) purple (c) black (d) yellow - 8.Which of these does CSS do? (a) changes the page live (b) changes the text size (c) puts a picture on a page (d) makes headings and lists
- 9.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) makes letters bigger (d) sets the letter colour
-
10.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-weight: bold;
} -
11.🖌️ Where does the text sit on its line?
h2 {
text-align: left;
color: white;
background-color: blue;
font-size: 20px;
} (a) on the right (b) in the middle (c) on the left - 12.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
- 13.🌈 In #440000 the red part is the hex number 44. What is it as a normal number?
- 14.🌈 Which colour of light is strongest in rgb(55, 180, 58)? (a) red (b) blue (c) green
- 15.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
-
16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 30px;
border: 3px solid black;
margin: 20px;
} -
17.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
.big { color: yellow; }
#logo { color: white; }
p { color: orange; } (a) white (b) black (c) yellow (d) orange -
18.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
#hero { color: blue; }
#hero { color: orange; } (a) white (b) orange (c) black (d) blue - 19.🎯 Can many elements share the same class? (a) No (b) Yes
- 20.🎯 Which sign starts an id selector? (a) @ (b) . (c) # (d) &
-
21.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 14px;
}
} - 22.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
-
23.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 25px;
border: 1px solid black;
margin: 0px;
} - 24.🌈 Which hex code is red? (a) #00ffff (b) #ff00ff (c) #0000ff (d) #ff0000
-
25.✍️ Which property is set to center in this rule?
p {
margin: 10px;
text-align: center;
} (a) background-color (b) text-align (c) center (d) margin -
26.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
27.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} (a) No (b) Yes -
28.✍️ How many declarations (property: value pairs) are in this rule?
p {
border: 2px solid;
} - 29.🖌️ Which CSS property makes the text bold? (a) color (b) font-size (c) font-family (d) font-weight
- 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
-
31.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 180px;
padding: 30px;
border: 2px solid black;
margin: 20px;
} - 32.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
- 33.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) changes the page live (d) gives the page structure
- 34.True or false: padding is the text or picture. (a) False (b) True
-
35.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 36.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) rounds box corners (d) makes headings and lists
- 37.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 100 (d) 99
-
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 4 boxes, each 40px wide (no margins). - 39.🎯 Which element does the selector span style? (a) <h1 class="note"> (b) <span class="note"> (c) <p> (d) <h2 id="top">
-
40.✍️ What is the selector in this CSS rule?
p {
color: red;
background-color: yellow;
} (a) .note (b) yellow (c) p (d) color
Answer key
- CSS
- color
- purple
- Yes
- font-family
- 600px or narrower
- black
- changes the text size
- makes the text bold
- 1
- on the left
- margin
- 68
- green
- an id selector
- 176
- white
- orange
- Yes
- #
- 14
- <style>
- 162
- #ff0000
- text-align
- 80
- No
- 1
- font-weight
- the later one
- 284
- HTML
- gives the page structure
- False
- 198
- rounds box corners
- 255
- 50
- <span class="note">
- p
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids