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.True or false: #logo is an id selector. (a) False (b) True
-
2.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
.note { color: yellow; }
.note { color: black; } (a) red (b) black (c) yellow (d) green - 3.🎯 Can many elements share the same class? (a) Yes (b) No
-
4.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} - 5.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
- 6.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
- 7.True or false: the border is space inside the border. (a) False (b) True
-
8.✍️ What value is given to font-weight in this rule?
.note {
font-weight: bold;
text-align: center;
} (a) font-weight (b) 2px solid (c) bold (d) 300px - 9.🎯 Which element does the selector #top style? (a) <span id="intro"> (b) <span class="top"> (c) <p class="box"> (d) <span id="top">
-
10.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 20px;
border: 4px solid black;
margin: 20px;
} - 11.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 12.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) align-items (c) display: flex (d) gap
- 13.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
-
14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} -
15.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
p { color: blue; }
p { color: orange; } (a) red (b) black (c) orange (d) blue -
16.⚖️ What colour is the text of this element?
<h1 class="note" id="intro">Hi</h1>
CSS:
h1 { color: purple; }
#intro { color: orange; }
.note { color: red; } (a) red (b) purple (c) orange (d) yellow - 17.True or false: #end is an element selector. (a) True (b) False
-
18.🎯 Which CSS selector matches this element?
<div class="big" id="intro">Hello</div> (a) .red (b) #big (c) div (d) #main - 19.True or false: img is an element selector. (a) True (b) False
- 20.True or false: .menu is an element selector. (a) False (b) True
- 21.What does font-weight do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
- 22.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
-
23.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
#hero { color: yellow; }
h1 { color: black; } (a) white (b) yellow (c) black (d) red -
24.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
.box { color: purple; }
.box { color: red; } (a) green (b) purple (c) red (d) blue - 25.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
- 26.🖌️ Which CSS property colours behind the text? (a) font-size (b) font-family (c) background-color (d) text-align
-
27.🖌️ How big is the text, in px?
p {
color: black;
text-align: center;
font-size: 24px;
background-color: red;
} - 28.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) has no pictures (d) is only for laptops
- 29.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
-
30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 190px;
padding: 25px;
border: 4px solid black;
margin: 5px;
} - 31.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
- 32.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
- 33.🌈 Which colour is #00ff00? (a) magenta (b) black (c) blue (d) bright green
-
34.📦 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: 10px;
border: 1px solid black;
margin: 15px;
} -
35.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 36.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
-
37.✍️ Which property is set to 2px solid in this rule?
.note {
border: 2px solid;
font-size: 20px;
background-color: yellow;
} (a) width (b) border (c) font-style (d) 2px solid -
38.🖌️ What colour are the letters?
li {
color: green;
text-align: center;
font-size: 36px;
background-color: blue;
} (a) blue (b) green (c) orange - 39.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) magenta (c) blue (d) white
-
40.⚖️ What colour is the text of this element?
<p class="menu" id="top">Hi</p>
CSS:
p { color: green; }
#top { color: black; } (a) black (b) green (c) red (d) yellow
Answer key
- True
- black
- Yes
- 28
- puts boxes in the middle
- 1
- False
- bold
- <span id="top">
- 288
- an element selector
- gap
- .
- 12
- orange
- orange
- False
- div
- True
- False
- makes the text bold
- the screen width
- yellow
- red
- many pages
- background-color
- 24
- fits every screen
- border
- 248
- blue
- F
- bright green
- 152
- Yes
- { }
- border
- green
- white
- black
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids