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 color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
- 2.True or false: #logo is a class selector. (a) False (b) True
- 3.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
- 4.🎯 What kind of selector is .star? (a) a class selector (b) an element selector (c) an id selector
- 5.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) [ ] (d) ( )
- 6.What does justify-content: flex-start 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
-
7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 290px;
padding: 15px;
border: 5px solid black;
margin: 15px;
} -
8.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 60px wide (no margins). -
9.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 130px;
padding: 5px;
border: 3px solid black;
margin: 20px;
} -
10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} - 11.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 12.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .css (d) .js
- 13.True or false: the content is the text or picture. (a) True (b) False
- 14.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
- 15.True or false: CSS makes a form box. (a) False (b) True
- 16.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
-
17.⚖️ What colour is the text of this element?
<h1 class="box" id="main">Hi</h1>
CSS:
.box { color: white; }
#main { color: black; }
h1 { color: green; } (a) green (b) blue (c) black (d) white - 18.🎯 Which element does the selector .note style? (a) <li class="big"> (b) <li class="note"> (c) <li id="note"> (d) <div class="red">
- 19.True or false: JavaScript gives the page structure. (a) False (b) True
- 20.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) margin (d) border
- 21.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
-
22.✍️ What value is given to margin in this rule?
h1 {
font-style: italic;
font-size: 20px;
margin: 10px;
} (a) 10px (b) margin (c) 8px (d) bold - 23.True or false: CSS sets colours and fonts. (a) False (b) True
- 24.💪 Which flexbox property lines boxes up across? (a) align-items (b) justify-content (c) display: flex (d) flex-direction
-
25.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} -
26.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). -
27.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 90px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} - 28.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
-
29.✍️ Which property is set to 300px in this rule?
.note {
width: 300px;
background-color: yellow;
} (a) color (b) width (c) font-style (d) 300px - 30.🌈 Which colour is #00ffff? (a) bright green (b) red (c) black (d) cyan
- 31.True or false: JavaScript makes headings and lists. (a) False (b) True
-
32.📱 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 - 33.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) rounds box corners (d) counts down a timer
- 34.What does font-family do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) picks the font style
- 35.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
-
36.✍️ What is the selector in this CSS rule?
p {
text-align: center;
border: 2px solid;
} (a) p (b) 2px solid (c) text-align (d) .note -
37.🖌️ What colour is behind the letters?
li {
color: yellow;
background-color: purple;
text-align: left;
font-size: 36px;
} (a) purple (b) green (c) yellow -
38.✍️ What is the selector in this CSS rule?
li {
width: 300px;
border: 2px solid;
text-align: center;
background-color: yellow;
} (a) 2px solid (b) body (c) width (d) li - 39.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) changes the page live
- 40.🌈 In #00f700 the green part is the hex number f7. What is it as a normal number?
Answer key
- color
- False
- JavaScript
- a class selector
- { }
- packs boxes at the start
- 330
- 10
- 146
- 20
- an element selector
- .css
- True
- a class selector
- False
- fits every screen
- black
- <li class="note">
- False
- padding
- packs boxes at the end
- 10px
- True
- align-items
- 24
- 30
- 140
- 1
- width
- cyan
- False
- Yes
- counts down a timer
- picks the font style
- blue
- p
- purple
- li
- changes the page live
- 247
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids