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 sign starts an id selector? (a) @ (b) . (c) & (d) #
- 2.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
- 3.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) makes a form box (d) reacts to a button click
-
4.🎯 Which CSS selector matches this element?
<div class="star" id="top">Hello</div> (a) .menu (b) span (c) div (d) #star -
5.✍️ What is the selector in this CSS rule?
body {
background-color: yellow;
border: 2px solid;
} (a) .box (b) body (c) background-color (d) 2px solid -
6.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 20px;
}
} (a) No (b) Yes -
7.✍️ What is the selector in this CSS rule?
h1 {
text-align: center;
font-style: italic;
} (a) p (b) italic (c) h1 (d) text-align -
8.🖌️ How big is the text, in px?
h2 {
text-align: center;
font-size: 24px;
color: red;
background-color: green;
} - 9.Which of these does HTML do? (a) sets colours and fonts (b) shows a pop-up message (c) makes headings and lists (d) rounds box corners
-
10.🖌️ Where does the text sit on its line?
li {
text-align: right;
color: red;
font-size: 40px;
background-color: yellow;
} (a) on the left (b) in the middle (c) on the right - 11.🌈 In #340000 the red part is the hex number 34. What is it as a normal number?
- 12.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) color (d) font-weight
-
13.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} - 14.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) never changes (d) fits every screen
- 15.What does font-weight do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) centres a heading
- 16.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) Z (d) J
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 20px;
border: 4px solid black;
margin: 5px;
} - 18.🌈 In #960000 the red part is the hex number 96. What is it as a normal number?
-
19.🖌️ What colour is behind the letters?
li {
background-color: purple;
text-align: center;
font-size: 40px;
color: red;
} (a) red (b) purple (c) yellow - 20.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-end (c) flex-start (d) center
- 21.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
- 22.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) blue (d) green
-
23.🖌️ What colour is behind the letters?
h1 {
text-align: left;
color: white;
background-color: green;
font-size: 20px;
} (a) red (b) white (c) green - 24.🔍 Which is the odd one out? (a) puts a picture on a page (b) changes the text size (c) adds space around boxes (d) sets colours and fonts
-
25.🖌️ What colour are the letters?
li {
font-size: 32px;
text-align: center;
background-color: red;
color: green;
} (a) red (b) orange (c) green - 26.Which of these does CSS do? (a) counts down a timer (b) makes a form box (c) gives the page structure (d) adds space around boxes
-
27.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 14px;
}
} (a) Yes (b) No -
28.✍️ Which property is set to 8px in this rule?
#top {
border: 2px solid;
margin: 10px;
padding: 8px;
color: red;
} (a) 8px (b) padding (c) border (d) font-weight -
29.✍️ Which property is set to 300px in this rule?
p {
margin: 10px;
padding: 8px;
width: 300px;
border: 2px solid;
} (a) color (b) 300px (c) width (d) font-style -
30.✍️ What value is given to margin in this rule?
h1 {
margin: 10px;
font-style: italic;
} (a) 8px (b) bold (c) margin (d) 10px -
31.✍️ What value is given to border in this rule?
h2 {
border: 2px solid;
font-weight: bold;
} (a) 2px solid (b) border (c) 300px (d) italic - 32.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 130px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 34.🎯 Which element does the selector .menu style? (a) <h2 class="note"> (b) <h2 id="menu"> (c) <li class="big"> (d) <h2 class="menu">
- 35.True or false: p is an element selector. (a) True (b) False
- 36.🔍 Which is the odd one out? (a) makes a form box (b) changes the page live (c) counts down a timer (d) reacts to a button click
- 37.Which of these does CSS do? (a) reacts to a button click (b) makes a link (c) rounds box corners (d) counts down a timer
- 38.🎨 One CSS file can style how many pages? (a) many pages (b) no pages (c) only one word (d) only one image
-
39.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
.menu { color: white; }
.menu { color: purple; } (a) purple (b) blue (c) yellow (d) white -
40.✍️ Which property is set to 8px in this rule?
.note {
text-align: center;
padding: 8px;
} (a) border (b) padding (c) font-weight (d) 8px
Answer key
- #
- { }
- reacts to a button click
- div
- body
- Yes
- h1
- 24
- makes headings and lists
- on the right
- 52
- background-color
- 16
- fits every screen
- makes the text bold
- F
- 148
- 150
- purple
- center
- packs boxes at the end
- blue
- green
- puts a picture on a page
- green
- adds space around boxes
- Yes
- padding
- width
- 10px
- 2px solid
- .css
- 176
- <h2 class="menu">
- True
- makes a form box
- rounds box corners
- many pages
- purple
- padding
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids