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.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} -
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 210px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 3.🌈 Which colour of light is strongest in rgb(62, 61, 255)? (a) green (b) red (c) blue
-
4.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-style: italic;
color: red;
padding: 8px;
} - 5.💪 Which flexbox property lines boxes up across? (a) display: flex (b) flex-direction (c) gap (d) align-items
-
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 7.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
- 8.True or false: #hero is an id selector. (a) False (b) True
- 9.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
-
10.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
11.✍️ Which property is set to red in this rule?
h2 {
text-align: center;
color: red;
font-style: italic;
margin: 10px;
} (a) red (b) font-size (c) color (d) text-align -
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 280px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). -
13.🖌️ What colour is behind the letters?
p {
font-size: 40px;
text-align: left;
color: yellow;
background-color: blue;
} (a) blue (b) red (c) yellow -
14.✍️ Which property is set to 20px in this rule?
.note {
font-size: 20px;
font-style: italic;
} (a) text-align (b) background-color (c) 20px (d) font-size -
15.⚖️ What colour is the text of this element?
<h2 class="note" id="top">Hi</h2>
CSS:
#top { color: yellow; }
.note { color: purple; }
h2 { color: green; } (a) purple (b) yellow (c) green (d) blue - 16.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-size
-
17.🎯 Which CSS selector matches this element?
<p class="star" id="hero">Hello</p> (a) #top (b) .menu (c) .star (d) .hero - 18.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
-
19.✍️ What is the selector in this CSS rule?
.note {
font-style: italic;
font-size: 20px;
background-color: yellow;
text-align: center;
} (a) font-style (b) #top (c) 20px (d) .note - 20.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space inside the border (d) space outside the border
- 21.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
-
22.⚖️ What colour is the text of this element?
<h2 class="box" id="main">Hi</h2>
CSS:
h2 { color: blue; }
#main { color: green; } (a) white (b) blue (c) green (d) purple -
23.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 24.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
-
25.🖌️ What colour are the letters?
li {
text-align: left;
background-color: black;
font-size: 20px;
color: red;
} (a) blue (b) black (c) red - 26.True or false: padding is the gap round content. (a) False (b) True
- 27.🎯 Which element does the selector #main style? (a) <p id="logo"> (b) <p class="main"> (c) <h1 class="box"> (d) <p id="main">
-
28.🖌️ Where does the text sit on its line?
h2 {
color: yellow;
background-color: blue;
text-align: center;
font-size: 16px;
} (a) on the right (b) on the left (c) in the middle - 29.🔍 Which is the odd one out? (a) lays out the page (b) reacts to a button click (c) changes the page live (d) counts down a timer
- 30.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
- 31.🧩 Which language rounds box corners? (a) CSS (b) HTML (c) JavaScript
- 32.🎯 Which element does the selector .menu style? (a) <h2 class="big"> (b) <h1 id="menu"> (c) <h1 class="menu"> (d) <h1 class="note">
-
33.✍️ What is the selector in this CSS rule?
.note {
margin: 10px;
width: 300px;
background-color: yellow;
} (a) 300px (b) margin (c) #top (d) .note -
34.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) No (b) Yes - 35.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 36.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
- 37.🎯 Can many elements share the same class? (a) Yes (b) No
- 38.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) red (c) bright green (d) white
-
39.🖌️ What colour are the letters?
h1 {
text-align: right;
font-size: 36px;
background-color: red;
color: orange;
} (a) yellow (b) red (c) orange - 40.🌈 Which colour is #000000? (a) blue (b) black (c) yellow (d) bright green
Answer key
- 20
- 284
- blue
- 3
- align-items
- 202
- JavaScript
- True
- /*
- No
- color
- 40
- blue
- font-size
- yellow
- background-color
- .star
- packs boxes at the start
- .note
- space outside the border
- 800px or wider
- green
- Yes
- HTML
- red
- True
- <p id="main">
- in the middle
- lays out the page
- ;
- CSS
- <h1 class="menu">
- .note
- Yes
- an id selector
- Cascading Style Sheets
- Yes
- bright green
- orange
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids