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 CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
- 2.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) center (d) space-between
-
3.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} -
4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 200px;
padding: 30px;
border: 5px solid black;
margin: 10px;
} - 5.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <style> (d) <css>
-
6.⚖️ What colour is the text of this element?
<h2 class="menu" id="main">Hi</h2>
CSS:
h2 { color: red; }
h2 { color: orange; } (a) orange (b) red (c) black (d) blue - 7.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) : (d) color
-
8.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} (a) No (b) Yes -
9.⚖️ What colour is the text of this element?
<h1 class="red" id="hero">Hi</h1>
CSS:
#hero { color: black; }
#hero { color: orange; } (a) red (b) yellow (c) black (d) orange -
10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 110px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} -
11.🎯 Which CSS selector matches this element?
<span class="star" id="main">Hello</span> (a) #star (b) #logo (c) #main (d) p -
12.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
#hero { color: yellow; }
#hero { color: red; } (a) white (b) red (c) black (d) yellow -
13.📦 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: 2px solid black;
margin: 15px;
} - 14.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) align-items (d) justify-content
-
15.📦 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: 20px;
} - 16.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 17.True or false: h1 is an element selector. (a) True (b) False
-
18.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 19.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
- 20.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
-
21.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} - 22.True or false: .note is an element selector. (a) True (b) False
- 23.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
- 24.True or false: HTML gives the page structure. (a) False (b) True
- 25.Which of these does JavaScript do? (a) adds space around boxes (b) makes headings and lists (c) counts down a timer (d) changes the text size
- 26.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
- 27.What does background-color do? (a) sets the letter colour (b) makes the text bold (c) colours behind the text (d) centres a heading
- 28.What does color do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
- 29.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
- 30.📦 In the box model, which part is the gap to other boxes? (a) padding (b) margin (c) border (d) content
- 31.True or false: .menu is an element selector. (a) True (b) False
- 32.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the br tag (d) the hr tag
-
33.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 34.True or false: CSS adds space around boxes. (a) True (b) False
- 35.What does text-align do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) makes letters bigger
- 36.True or false: JavaScript rounds box corners. (a) False (b) True
-
37.⚖️ What colour is the text of this element?
<p class="star" id="intro">Hi</p>
CSS:
#intro { color: yellow; }
#intro { color: white; } (a) yellow (b) blue (c) white (d) purple -
38.🖌️ Where does the text sit on its line?
p {
color: green;
text-align: right;
background-color: yellow;
font-size: 16px;
} (a) on the left (b) on the right (c) in the middle -
39.✍️ Which property is set to 300px in this rule?
body {
padding: 8px;
font-style: italic;
font-size: 20px;
width: 300px;
} (a) font-style (b) width (c) 300px (d) color - 40.True or false: img is an element selector. (a) False (b) True
Answer key
- color
- space-between
- 24
- 270
- <style>
- orange
- blue
- Yes
- orange
- 172
- #main
- red
- 324
- display: flex
- 152
- an id selector
- True
- 16
- many pages
- fits every screen
- 12
- False
- /*
- True
- counts down a timer
- HTML
- colours behind the text
- sets the letter colour
- 3
- margin
- False
- the viewport meta tag
- Yes
- True
- centres a heading
- False
- white
- on the right
- width
- True
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids