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: .card is an id selector. (a) True (b) False
- 2.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
-
3.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
4.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-style: italic;
padding: 8px;
} - 5.🌈 Which hex code is black? (a) #ff00ff (b) #00ff00 (c) #ffff00 (d) #000000
- 6.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) border (d) margin
- 7.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
- 8.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
-
9.🎯 Which CSS selector matches this element?
<p class="menu" id="hero">Hello</p> (a) #menu (b) .note (c) #top (d) .menu -
10.⚖️ What colour is the text of this element?
<h1 class="big" id="logo">Hi</h1>
CSS:
.big { color: black; }
h1 { color: blue; } (a) red (b) blue (c) black (d) yellow -
11.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} - 12.🎯 What kind of selector is #top? (a) a class selector (b) an element selector (c) an id selector
- 13.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) 600px or narrower (d) exactly 1000px
- 14.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
- 15.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) blue (d) black
- 16.💪 Which flexbox property lines boxes up across? (a) align-items (b) justify-content (c) display: flex (d) gap
- 17.Which of these does JavaScript do? (a) makes a link (b) reacts to a button click (c) makes headings and lists (d) rounds box corners
- 18.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) cyan (c) bright green (d) red
- 19.What does background-color do? (a) picks the font style (b) sets the letter colour (c) colours behind the text (d) centres a heading
- 20.📦 In the box model, which part is the line round the box? (a) padding (b) border (c) margin (d) content
-
21.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 22.True or false: JavaScript makes a form box. (a) False (b) True
- 23.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
-
24.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 10px;
border: 4px solid black;
margin: 15px;
} - 25.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
- 26.🌈 Which colour of light is strongest in rgb(236, 4, 37)? (a) green (b) blue (c) red
-
27.🖌️ What colour are the letters?
h1 {
text-align: left;
background-color: purple;
color: red;
font-size: 28px;
} (a) black (b) red (c) purple - 28.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-weight (d) font-size
-
29.🎯 Which CSS selector matches this element?
<span class="note" id="end">Hello</span> (a) .big (b) #end (c) .end (d) #hero -
30.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 15px;
border: 1px solid black;
margin: 15px;
} - 31.🌈 Which colour is #ffff00? (a) black (b) white (c) bright green (d) yellow
- 32.🎯 What kind of selector is body? (a) a class selector (b) an id selector (c) an element selector
- 33.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) font-weight (d) font-size
- 34.🎯 What kind of selector is .star? (a) a class selector (b) an id selector (c) an element selector
-
35.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 36.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
-
37.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 200px;
padding: 30px;
border: 1px solid black;
margin: 15px;
} -
38.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 420px;
justify-content: space-between;
}
Inside are 3 boxes, each 100px wide (no margins). - 39.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
-
40.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) No (b) Yes
Answer key
- False
- .
- No
- 2
- #000000
- margin
- Cascading Style Sheets
- fits every screen
- .menu
- black
- 24
- an id selector
- 600px or narrower
- an element selector
- red
- align-items
- reacts to a button click
- red
- colours behind the text
- border
- Yes
- False
- <style>
- 318
- an id selector
- red
- red
- color
- #end
- 142
- yellow
- an element selector
- text-align
- a class selector
- No
- an element selector
- 292
- 60
- HTML
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids