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 many declarations (property: value pairs) are in this rule?
h2 {
font-weight: bold;
} - 2.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) makes a link (d) adds space around boxes
- 3.True or false: padding is the gap round content. (a) True (b) False
- 4.🖌️ Which CSS property centres a heading? (a) color (b) background-color (c) font-family (d) text-align
- 5.🌈 Which colour is #ffffff? (a) bright green (b) black (c) yellow (d) white
-
6.🎯 Which CSS selector matches this element?
<li class="red" id="end">Hello</li> (a) div (b) .end (c) .red (d) .box - 7.🌈 Which colour of light is strongest in rgb(176, 129, 105)? (a) red (b) green (c) blue
- 8.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
- 9.🌈 Which colour of light is strongest in rgb(234, 9, 15)? (a) green (b) red (c) blue
-
10.✍️ Which property is set to red in this rule?
h2 {
width: 300px;
color: red;
} (a) text-align (b) font-size (c) red (d) color - 11.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
-
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins). - 13.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
-
14.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} -
15.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 18px;
}
} - 16.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
-
17.🖌️ What colour is behind the letters?
h2 {
text-align: left;
font-size: 36px;
color: purple;
background-color: green;
} (a) green (b) purple (c) yellow -
18.🖌️ What colour are the letters?
p {
text-align: center;
background-color: white;
font-size: 12px;
color: black;
} (a) black (b) yellow (c) white -
19.✍️ What value is given to font-style in this rule?
h2 {
font-style: italic;
background-color: yellow;
} (a) 20px (b) red (c) font-style (d) italic - 20.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) padding (d) content
- 21.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
- 22.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
- 23.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) yellow (c) magenta (d) cyan
-
24.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 280px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). -
25.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
p { color: green; }
.box { color: red; }
#top { color: orange; } (a) green (b) white (c) red (d) orange - 26.🌈 Which colour is #000000? (a) blue (b) bright green (c) black (d) red
- 27.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Computer Style Sheets (d) Creative Sheet System
-
28.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 20px;
border: 4px solid black;
margin: 10px;
} -
29.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} -
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 120px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). -
31.🎯 Which CSS selector matches this element?
<h2 class="big" id="logo">Hello</h2> (a) li (b) .logo (c) #logo (d) #big -
32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 150px;
padding: 20px;
border: 2px solid black;
margin: 20px;
} - 33.🌈 Which hex code is bright green? (a) #00ff00 (b) #ffff00 (c) #ff00ff (d) #ffffff
- 34.What does color do? (a) picks the font style (b) makes letters bigger (c) sets the letter colour (d) centres a heading
- 35.Which of these does HTML do? (a) changes the page live (b) gives the page structure (c) rounds box corners (d) counts down a timer
-
36.✍️ What is the selector in this CSS rule?
.note {
border: 2px solid;
width: 300px;
background-color: yellow;
color: red;
} (a) border (b) #top (c) .note (d) 300px -
37.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
.menu { color: black; }
p { color: red; } (a) purple (b) blue (c) red (d) black -
38.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
.big { color: orange; }
.big { color: blue; } (a) orange (b) white (c) blue (d) purple - 39.🌈 In #270000 the red part is the hex number 27. What is it as a normal number?
- 40.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 2 (c) 4 (d) 3
Answer key
- 1
- adds space around boxes
- True
- text-align
- white
- .red
- red
- /*
- red
- color
- <link>
- 20
- many pages
- 26
- 24
- 1
- green
- black
- italic
- margin
- color
- ;
- magenta
- 80
- orange
- black
- Cascading Style Sheets
- 138
- 132
- 10
- #logo
- 194
- #00ff00
- sets the letter colour
- gives the page structure
- .note
- black
- blue
- 39
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids