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.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 130px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 2.🌈 In #000045 the blue part is the hex number 45. What is it as a normal number?
-
3.🖌️ How big is the text, in px?
h2 {
text-align: center;
font-size: 32px;
background-color: green;
color: blue;
} - 4.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
- 5.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
- 6.Which of these does CSS do? (a) gives the page structure (b) reacts to a button click (c) changes the text size (d) changes the page live
- 7.📦 In the box model, which part is the text or picture? (a) border (b) content (c) margin (d) padding
- 8.True or false: the content is space inside the border. (a) True (b) False
- 9.🎯 Which element does the selector #main style? (a) <p class="box"> (b) <span id="logo"> (c) <span class="main"> (d) <span id="main">
-
10.🖌️ What colour is behind the letters?
h1 {
text-align: right;
color: red;
background-color: black;
font-size: 16px;
} (a) red (b) black (c) orange - 11.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
-
12.🖌️ What colour are the letters?
h2 {
text-align: left;
font-size: 20px;
color: red;
background-color: yellow;
} (a) yellow (b) red (c) black - 13.True or false: padding is the gap round content. (a) True (b) False
-
14.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 15.🌈 In #300000 the red part is the hex number 30. What is it as a normal number?
- 16.🌈 Which colour is #0000ff? (a) black (b) blue (c) red (d) yellow
- 17.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
- 18.🌈 In #790000 the red part is the hex number 79. What is it as a normal number?
- 19.What does background-color do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) colours behind the text
- 20.What does font-size do? (a) colours behind the text (b) sets the letter colour (c) makes the text bold (d) makes letters bigger
-
21.✍️ What is the selector in this CSS rule?
#top {
font-style: italic;
font-weight: bold;
text-align: center;
width: 300px;
} (a) li (b) bold (c) font-style (d) #top -
22.⚖️ What colour is the text of this element?
<h2 class="red" id="intro">Hi</h2>
CSS:
h2 { color: green; }
.red { color: orange; }
#intro { color: red; } (a) orange (b) green (c) red (d) white - 23.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
-
24.🎯 Which CSS selector matches this element?
<span class="menu" id="main">Hello</span> (a) #logo (b) p (c) #main (d) .main - 25.What does font-family do? (a) makes letters bigger (b) centres a heading (c) makes the text bold (d) picks the font style
-
26.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: center;
}
Inside are 2 boxes, each 40px wide (no margins). - 27.True or false: CSS sets colours and fonts. (a) True (b) False
-
28.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 380px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). - 29.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
- 30.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Computer Style Sheets (d) Cascading Style Sheets
- 31.🌈 Which colour is #00ff00? (a) red (b) bright green (c) black (d) magenta
- 32.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
-
33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} - 34.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
- 35.Which of these does CSS do? (a) makes a link (b) makes headings and lists (c) lays out the page (d) makes a form box
- 36.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
- 37.🌈 Which colour is #000000? (a) cyan (b) bright green (c) blue (d) black
-
38.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} - 39.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
-
40.🎯 Which CSS selector matches this element?
<h1 class="red" id="main">Hello</h1> (a) .red (b) .box (c) .main (d) #logo
Answer key
- 228
- 69
- 32
- a class selector
- justify-content
- changes the text size
- content
- False
- <span id="main">
- black
- an id selector
- red
- True
- No
- 48
- blue
- /*
- 121
- colours behind the text
- makes letters bigger
- #top
- red
- ;
- #main
- picks the font style
- 20
- True
- 20
- a class selector
- Cascading Style Sheets
- bright green
- 255
- 10
- a class selector
- lays out the page
- 600px or narrower
- black
- 152
- many pages
- .red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids