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 selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 2.True or false: JavaScript gives the page structure. (a) False (b) True
- 3.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
-
4.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 30px;
}
} (a) No (b) Yes -
5.✍️ Which property is set to 20px in this rule?
.box {
background-color: yellow;
font-size: 20px;
padding: 8px;
text-align: center;
} (a) 20px (b) background-color (c) text-align (d) font-size -
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: 280px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} - 7.🔍 Which is the odd one out? (a) gives the page structure (b) checks a quiz answer (c) reacts to a button click (d) changes the page live
-
8.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
h1 { color: black; }
h1 { color: yellow; } (a) green (b) blue (c) black (d) yellow -
9.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 10.🎯 Which element does the selector .red style? (a) <p id="red"> (b) <h1 class="star"> (c) <p class="red"> (d) <p class="box">
- 11.🌈 Which hex code is white? (a) #ff00ff (b) #00ffff (c) #00ff00 (d) #ffffff
-
12.✍️ How many declarations (property: value pairs) are in this rule?
.box {
background-color: yellow;
font-style: italic;
margin: 10px;
font-weight: bold;
} -
13.⚖️ What colour is the text of this element?
<p class="box" id="logo">Hi</p>
CSS:
p { color: green; }
p { color: black; } (a) yellow (b) blue (c) black (d) green - 14.True or false: HTML makes a link. (a) True (b) False
-
15.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 2px solid black;
margin: 15px;
} -
16.✍️ What value is given to background-color in this rule?
.note {
color: red;
padding: 8px;
background-color: yellow;
width: 300px;
} (a) yellow (b) background-color (c) 8px (d) 10px - 17.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) yellow (c) bright green (d) white
-
18.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} - 19.🎯 Which element does the selector .big style? (a) <span class="box"> (b) <div class="red"> (c) <div id="big"> (d) <div class="big">
- 20.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
-
21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} - 22.True or false: CSS rounds box corners. (a) False (b) True
- 23.Which of these does CSS do? (a) puts a picture on a page (b) makes a link (c) rounds box corners (d) makes headings and lists
- 24.What does justify-content: flex-start do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
-
25.🎯 Which CSS selector matches this element?
<li class="box" id="main">Hello</li> (a) .star (b) #box (c) li (d) div - 26.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) gives the page structure (d) changes the page live
-
27.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} - 28.Which of these does HTML do? (a) changes the text size (b) makes a form box (c) shows a pop-up message (d) adds space around boxes
-
29.🎯 Which CSS selector matches this element?
<h1 class="note" id="top">Hello</h1> (a) h2 (b) .note (c) #intro (d) .big - 30.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
- 31.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) has no pictures (d) is only for laptops
- 32.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) any number (d) 5
-
33.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-size: 20px;
font-style: italic;
width: 300px;
margin: 10px;
} - 34.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) makes headings and lists (d) lays out the page
- 35.📱 What does a media query check? (a) the battery level (b) the screen width (c) the time of day (d) the page title
-
36.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
h2 { color: yellow; }
h2 { color: orange; } (a) green (b) orange (c) yellow (d) purple -
37.🖌️ What colour are the letters?
li {
font-size: 24px;
background-color: black;
color: green;
text-align: right;
} (a) green (b) blue (c) black - 38.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
- 39.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) the gap round content (d) space outside the border
- 40.🔍 Which is the odd one out? (a) puts a picture on a page (b) gives the page structure (c) makes a form box (d) lays out the page
Answer key
- an id selector
- False
- ;
- Yes
- font-size
- 298
- gives the page structure
- yellow
- No
- <p class="red">
- #ffffff
- 4
- black
- True
- 214
- yellow
- yellow
- 6
- <div class="big">
- 600px or narrower
- 14
- True
- rounds box corners
- packs boxes at the start
- li
- changes the page live
- 30
- makes a form box
- .note
- many pages
- fits every screen
- 1
- 4
- lays out the page
- the screen width
- orange
- green
- an element selector
- space outside the border
- lays out the page
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids