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 CSS property colours behind the text? (a) background-color (b) text-align (c) font-size (d) font-family
- 2.What does font-weight do? (a) sets the letter colour (b) colours behind the text (c) makes the text bold (d) makes letters bigger
- 3.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Computer Style Sheets (d) Creative Sheet System
- 4.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) 800px or narrower (d) turned off
- 5.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
-
6.✍️ Which property is set to 8px in this rule?
.box {
font-weight: bold;
font-size: 20px;
padding: 8px;
} (a) 8px (b) font-weight (c) border (d) padding - 7.🎨 Which attribute adds CSS inside one tag? (a) alt (b) style (c) href (d) src
-
8.✍️ What is the selector in this CSS rule?
.note {
color: red;
border: 2px solid;
width: 300px;
} (a) color (b) #top (c) .note (d) 2px solid - 9.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
- 10.What does font-size do? (a) centres a heading (b) picks the font style (c) makes letters bigger (d) sets the letter colour
- 11.🌈 Which colour of light is strongest in rgb(219, 99, 27)? (a) red (b) blue (c) green
-
12.🖌️ What colour are the letters?
p {
background-color: white;
text-align: center;
font-size: 20px;
color: green;
} (a) green (b) orange (c) white - 13.What does color do? (a) makes letters bigger (b) centres a heading (c) makes the text bold (d) sets the letter colour
- 14.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
-
15.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} - 16.🎯 Which element does the selector #intro style? (a) <h1 class="note"> (b) <p class="intro"> (c) <p id="main"> (d) <p id="intro">
- 17.🌈 Which colour is #ffffff? (a) red (b) white (c) blue (d) cyan
- 18.🎯 Which element does the selector h2 style? (a) <div class="note"> (b) <span id="intro"> (c) <li> (d) <h2 class="note">
- 19.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
-
20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} - 21.🔍 Which is the odd one out? (a) adds space around boxes (b) lays out the page (c) shows a pop-up message (d) sets colours and fonts
- 22.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
- 23.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) blue (c) white (d) yellow
-
24.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
h2 { color: white; }
#logo { color: blue; }
.star { color: red; } (a) blue (b) white (c) black (d) red - 25.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
- 26.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
-
27.🎯 Which CSS selector matches this element?
<h2 class="box" id="end">Hello</h2> (a) .star (b) li (c) #box (d) .box -
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 160px;
padding: 10px;
border: 1px solid black;
margin: 0px;
} - 29.🌈 Which colour is #000000? (a) yellow (b) white (c) black (d) cyan
-
30.🖌️ What colour are the letters?
p {
color: green;
background-color: black;
font-size: 32px;
text-align: right;
} (a) black (b) green (c) orange - 31.🌈 In #710000 the red part is the hex number 71. What is it as a normal number?
-
32.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} - 33.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
- 34.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) changes the page live (d) makes headings and lists
- 35.True or false: .menu is an element selector. (a) False (b) True
- 36.Which of these does JavaScript do? (a) changes the text size (b) lays out the page (c) shows a pop-up message (d) rounds box corners
-
37.⚖️ What colour is the text of this element?
<h1 class="box" id="intro">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: black; } (a) red (b) black (c) orange (d) blue -
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 480px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). -
39.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 32px;
}
} -
40.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 140px;
justify-content: space-between;
}
Inside are 3 boxes, each 40px wide (no margins).
Answer key
- background-color
- makes the text bold
- Cascading Style Sheets
- 800px or wider
- { }
- padding
- style
- .note
- an element selector
- makes letters bigger
- red
- green
- sets the letter colour
- :
- 22
- <p id="intro">
- white
- <h2 class="note">
- JavaScript
- 160
- shows a pop-up message
- many pages
- bright green
- blue
- blue
- color
- .box
- 182
- black
- green
- 113
- 18
- padding
- changes the page live
- False
- shows a pop-up message
- black
- 40
- 32
- 10
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids