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.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
- 2.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
- 3.True or false: JavaScript makes headings and lists. (a) True (b) False
-
4.✍️ Which property is set to center in this rule?
h2 {
width: 300px;
text-align: center;
} (a) background-color (b) text-align (c) center (d) margin -
5.✍️ How many declarations (property: value pairs) are in this rule?
.note {
margin: 10px;
text-align: center;
} -
6.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 7.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) changes the page live (d) rounds box corners
-
8.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 20px;
}
} - 9.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
-
10.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-style: italic;
font-size: 20px;
color: red;
width: 300px;
} - 11.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
-
12.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
p { color: blue; }
p { color: yellow; } (a) green (b) white (c) yellow (d) blue - 13.What does font-family do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) picks the font style
-
14.🎯 Which CSS selector matches this element?
<p class="note" id="logo">Hello</p> (a) .logo (b) h1 (c) .big (d) #logo -
15.🖌️ How big is the text, in px?
h1 {
color: black;
text-align: left;
background-color: green;
font-size: 20px;
} - 16.True or false: .menu is an element selector. (a) True (b) False
-
17.✍️ What is the selector in this CSS rule?
li {
border: 2px solid;
font-weight: bold;
} (a) bold (b) body (c) li (d) border - 18.🎯 How many elements on a page should have the same id? (a) 2 (b) 1 (c) any number (d) 5
- 19.Which of these is the border? (a) the text or picture (b) space outside the border (c) a solid or dotted edge (d) the gap round content
- 20.🖌️ Which CSS property picks the font style? (a) text-align (b) font-weight (c) background-color (d) font-family
- 21.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
-
22.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 150px;
padding: 5px;
border: 3px solid black;
margin: 10px;
} - 23.🖌️ Which CSS property centres a heading? (a) font-size (b) font-family (c) text-align (d) color
-
24.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 25.🔍 Which is the odd one out? (a) changes the page live (b) gives the page structure (c) counts down a timer (d) shows a pop-up message
- 26.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) the text or picture (d) space inside the border
- 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
-
28.🎯 Which CSS selector matches this element?
<span class="note" id="main">Hello</span> (a) #main (b) p (c) .big (d) #note -
29.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 10px;
border: 4px solid black;
margin: 20px;
} - 30.🎯 Which element does the selector #top style? (a) <h2 class="top"> (b) <h2 id="intro"> (c) <h2 id="top"> (d) <li class="box">
-
31.🖌️ What colour are the letters?
h2 {
color: purple;
font-size: 28px;
text-align: left;
background-color: black;
} (a) black (b) red (c) purple -
32.✍️ Which property is set to 10px in this rule?
p {
margin: 10px;
font-size: 20px;
font-style: italic;
} (a) margin (b) padding (c) font-weight (d) 10px -
33.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
#hero { color: orange; }
h1 { color: white; } (a) white (b) red (c) orange (d) yellow -
34.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} - 35.True or false: h1 is an element selector. (a) True (b) False
- 36.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
-
37.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 22px;
}
} - 38.True or false: CSS rounds box corners. (a) False (b) True
- 39.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
- 40.🎯 Which element does the selector #top style? (a) <div id="intro"> (b) <div class="top"> (c) <div id="top"> (d) <span class="big">
Answer key
- packs boxes at the start
- blue
- False
- text-align
- 2
- No
- changes the page live
- 12
- #
- 4
- fits every screen
- yellow
- picks the font style
- #logo
- 20
- False
- li
- 1
- a solid or dotted edge
- font-family
- HTML
- 186
- text-align
- Yes
- gives the page structure
- space inside the border
- the later one
- #main
- 198
- <h2 id="top">
- purple
- margin
- orange
- 16
- True
- puts boxes in the middle
- 16
- True
- { }
- <div id="top">
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids