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 CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Computer Style Sheets (d) Cascading Style Sheets
- 2.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) margin (d) content
- 3.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) flex-end (d) center
-
4.✍️ What value is given to color in this rule?
li {
background-color: yellow;
font-weight: bold;
font-size: 20px;
color: red;
} (a) center (b) 20px (c) red (d) color - 5.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
-
6.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 250px;
justify-content: flex-end;
}
Inside are 3 boxes, each 80px wide (no margins). -
7.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 140px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 8.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) < > (d) ( )
-
9.✍️ How many declarations (property: value pairs) are in this rule?
.box {
color: red;
} -
10.⚖️ What colour is the text of this element?
<h1 class="box" id="intro">Hi</h1>
CSS:
.box { color: blue; }
.box { color: orange; } (a) green (b) blue (c) yellow (d) orange - 11.🌈 Which hex code is red? (a) #ff0000 (b) #00ff00 (c) #ffff00 (d) #ff00ff
- 12.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
- 13.True or false: the border is the line round the box. (a) False (b) True
-
14.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} - 15.🌈 Which colour of light is strongest in rgb(117, 125, 193)? (a) green (b) red (c) blue
-
16.⚖️ What colour is the text of this element?
<h2 class="note" id="intro">Hi</h2>
CSS:
#intro { color: blue; }
#intro { color: green; } (a) white (b) red (c) blue (d) green - 17.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
-
18.🎯 Which CSS selector matches this element?
<li class="big" id="logo">Hello</li> (a) .big (b) .logo (c) .red (d) #end - 19.🎯 Which element does the selector #logo style? (a) <h1 class="box"> (b) <p id="logo"> (c) <p id="end"> (d) <p class="logo">
-
20.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
#end { color: orange; }
#end { color: yellow; } (a) orange (b) white (c) yellow (d) purple - 21.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
-
22.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 130px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
23.🖌️ What colour is behind the letters?
h1 {
background-color: black;
color: green;
text-align: center;
font-size: 24px;
} (a) white (b) green (c) black -
24.🖌️ How big is the text, in px?
li {
font-size: 12px;
background-color: orange;
text-align: center;
color: green;
} - 25.True or false: JavaScript makes a form box. (a) False (b) True
-
26.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} - 27.True or false: #end is an id selector. (a) True (b) False
-
28.🖌️ How big is the text, in px?
h2 {
background-color: black;
text-align: center;
font-size: 12px;
color: white;
} -
29.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 30.Which of these does HTML do? (a) adds space around boxes (b) reacts to a button click (c) changes the text size (d) makes a link
-
31.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} (a) Yes (b) No - 32.📦 In the box model, which part is space outside the border? (a) margin (b) padding (c) content (d) border
- 33.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
- 34.🌈 Which colour is #ff00ff? (a) magenta (b) red (c) cyan (d) bright green
-
35.✍️ What value is given to border in this rule?
.box {
border: 2px solid;
font-weight: bold;
width: 300px;
padding: 8px;
} (a) italic (b) 300px (c) 2px solid (d) border -
36.✍️ Which property is set to 8px in this rule?
body {
padding: 8px;
font-style: italic;
} (a) font-weight (b) 8px (c) border (d) padding - 37.True or false: JavaScript counts down a timer. (a) True (b) False
-
38.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
39.✍️ What is the selector in this CSS rule?
.note {
width: 300px;
font-weight: bold;
} (a) bold (b) #top (c) .note (d) width -
40.⚖️ What colour is the text of this element?
<h1 class="menu" id="logo">Hi</h1>
CSS:
h1 { color: white; }
#logo { color: red; } (a) white (b) red (c) green (d) orange
Answer key
- Cascading Style Sheets
- border
- center
- red
- HTML
- 10
- 180
- { }
- 1
- orange
- #ff0000
- fits every screen
- True
- 24
- blue
- green
- packs boxes at the start
- .big
- <p id="logo">
- yellow
- an id selector
- 10
- black
- 12
- False
- 14
- True
- 12
- Yes
- makes a link
- Yes
- margin
- a class selector
- magenta
- 2px solid
- padding
- True
- Yes
- .note
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids