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 justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
-
2.✍️ What value is given to margin in this rule?
#top {
margin: 10px;
color: red;
width: 300px;
font-weight: bold;
} (a) bold (b) margin (c) 10px (d) 8px - 3.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
-
4.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} (a) No (b) Yes - 5.🌈 Which colour is rgb(255, 0, 255)? (a) white (b) black (c) magenta (d) bright green
- 6.🌈 Which hex code is white? (a) #00ff00 (b) #000000 (c) #ffffff (d) #0000ff
- 7.True or false: HTML adds space around boxes. (a) True (b) False
- 8.🌈 In #006500 the green part is the hex number 65. What is it as a normal number?
- 9.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
- 10.Which of these does HTML do? (a) gives the page structure (b) lays out the page (c) adds space around boxes (d) checks a quiz answer
-
11.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
.red { color: green; }
p { color: yellow; }
#logo { color: blue; } (a) green (b) blue (c) orange (d) yellow -
12.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 110px;
padding: 5px;
border: 5px solid black;
margin: 20px;
} - 13.True or false: CSS counts down a timer. (a) True (b) False
-
14.🎯 Which CSS selector matches this element?
<div class="box" id="hero">Hello</div> (a) #top (b) span (c) div (d) #box - 15.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
- 16.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
- 17.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
- 18.📦 In the box model, which part is space outside the border? (a) content (b) border (c) margin (d) padding
-
19.⚖️ What colour is the text of this element?
<p class="star" id="logo">Hi</p>
CSS:
#logo { color: green; }
#logo { color: yellow; } (a) green (b) yellow (c) orange (d) white -
20.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} (a) Yes (b) No - 21.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
-
22.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 23.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-weight (d) font-size
- 24.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
- 25.🔍 Which is the odd one out? (a) shows a pop-up message (b) checks a quiz answer (c) changes the page live (d) gives the page structure
-
26.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} (a) No (b) Yes -
27.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 480px) {
p {
font-size: 14px;
}
} (a) No (b) Yes -
28.🎯 Which CSS selector matches this element?
<p class="box" id="end">Hello</p> (a) #box (b) .end (c) .box (d) .star - 29.True or false: JavaScript reacts to a button click. (a) True (b) False
- 30.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-family
- 31.True or false: .menu is an element selector. (a) True (b) False
-
32.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 160px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
33.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 330px;
justify-content: space-between;
}
Inside are 4 boxes, each 60px wide (no margins). - 34.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
-
35.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 22px;
}
} (a) Yes (b) No -
36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 220px;
padding: 5px;
border: 2px solid black;
margin: 0px;
} -
37.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
.box { color: blue; }
.box { color: purple; } (a) purple (b) white (c) black (d) blue - 38.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
-
39.📱 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;
}
} -
40.✍️ How many declarations (property: value pairs) are in this rule?
#top {
margin: 10px;
}
Answer key
- flex-start
- 10px
- ;
- No
- magenta
- #ffffff
- False
- 101
- <style>
- gives the page structure
- blue
- 170
- False
- div
- border
- an id selector
- centres a heading
- margin
- yellow
- No
- 800px or wider
- No
- font-size
- /*
- gives the page structure
- Yes
- No
- .box
- True
- background-color
- False
- 60
- 30
- { }
- Yes
- 234
- purple
- HTML
- 12
- 1
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids