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 puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
-
2.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 190px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). - 3.🌈 Which colour is #ff0000? (a) white (b) red (c) yellow (d) cyan
- 4.🖌️ Which CSS property sets the letter colour? (a) font-family (b) text-align (c) color (d) font-weight
- 5.🎨 A CSS file usually ends with which extension? (a) .html (b) .js (c) .css (d) .png
- 6.🌈 Which colour is #ff00ff? (a) black (b) yellow (c) magenta (d) blue
-
7.🖌️ What colour are the letters?
h1 {
font-size: 12px;
text-align: left;
color: red;
background-color: blue;
} (a) red (b) blue (c) purple - 8.🌈 In #00009f the blue part is the hex number 9f. What is it as a normal number?
- 9.🌈 In #ef0000 the red part is the hex number ef. What is it as a normal number?
-
10.🎯 Which CSS selector matches this element?
<span class="big" id="end">Hello</span> (a) #big (b) #hero (c) .big (d) .red - 11.Which of these is margin? (a) the text or picture (b) space inside the border (c) space outside the border (d) the gap round content
- 12.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
-
13.⚖️ What colour is the text of this element?
<p class="note" id="top">Hi</p>
CSS:
#top { color: black; }
p { color: yellow; }
.note { color: white; } (a) white (b) purple (c) yellow (d) black - 14.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) center (d) flex-start
- 15.Which of these does HTML do? (a) changes the page live (b) reacts to a button click (c) lays out the page (d) makes headings and lists
-
16.🖌️ What colour is behind the letters?
p {
background-color: white;
text-align: left;
color: blue;
font-size: 16px;
} (a) blue (b) red (c) white -
17.🎯 Which CSS selector matches this element?
<span class="star" id="intro">Hello</span> (a) .menu (b) .intro (c) #intro (d) #star -
18.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} -
19.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 180px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
20.⚖️ What colour is the text of this element?
<p class="red" id="end">Hi</p>
CSS:
#end { color: purple; }
.red { color: red; } (a) red (b) orange (c) purple (d) black - 21.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 22.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
-
23.✍️ Which property is set to yellow in this rule?
.box {
margin: 10px;
background-color: yellow;
font-weight: bold;
font-size: 20px;
} (a) padding (b) background-color (c) yellow (d) margin - 24.Which of these does CSS do? (a) makes a link (b) reacts to a button click (c) makes headings and lists (d) lays out the page
- 25.True or false: margin is the gap to other boxes. (a) False (b) True
-
26.🖌️ What colour are the letters?
p {
color: yellow;
font-size: 32px;
text-align: center;
background-color: orange;
} (a) yellow (b) black (c) orange - 27.🎯 Which element does the selector h2 style? (a) <h2 class="menu"> (b) <li> (c) <div class="menu"> (d) <span id="logo">
- 28.True or false: JavaScript reacts to a button click. (a) False (b) True
- 29.🌈 In #00d100 the green part is the hex number d1. What is it as a normal number?
-
30.✍️ What is the selector in this CSS rule?
.box {
font-size: 20px;
padding: 8px;
width: 300px;
font-style: italic;
} (a) font-size (b) 8px (c) .box (d) h2 - 31.True or false: padding is space inside the border. (a) True (b) False
- 32.🎯 Which element does the selector #top style? (a) <li class="top"> (b) <div class="big"> (c) <li id="intro"> (d) <li id="top">
-
33.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
h1 { color: orange; }
.note { color: blue; }
#logo { color: purple; } (a) orange (b) purple (c) white (d) blue - 34.Which of these does JavaScript do? (a) gives the page structure (b) makes headings and lists (c) lays out the page (d) checks a quiz answer
- 35.🎯 What kind of selector is img? (a) an element selector (b) an id selector (c) a class selector
-
36.✍️ Which property is set to 10px in this rule?
.note {
margin: 10px;
padding: 8px;
background-color: yellow;
width: 300px;
} (a) margin (b) font-weight (c) padding (d) 10px - 37.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
- 38.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
-
39.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: white; } (a) blue (b) red (c) black (d) white - 40.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
Answer key
- center
- 10
- red
- color
- .css
- magenta
- red
- 159
- 239
- .big
- space outside the border
- { }
- black
- space-between
- makes headings and lists
- white
- #intro
- 20
- 60
- purple
- an element selector
- packs boxes at the end
- background-color
- lays out the page
- True
- yellow
- <h2 class="menu">
- True
- 209
- .box
- True
- <li id="top">
- purple
- checks a quiz answer
- an element selector
- margin
- CSS
- #
- white
- JavaScript
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids