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 element does the selector .big style? (a) <h2 class="box"> (b) <h1 class="red"> (c) <h1 id="big"> (d) <h1 class="big">
- 2.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-size (d) text-align
-
3.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 300px;
justify-content: center;
}
Inside are 3 boxes, each 60px wide (no margins). - 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) Z (d) G
- 5.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) cyan (c) magenta (d) black
- 6.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
-
7.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 210px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). - 8.🎯 Which element does the selector #main style? (a) <h1 id="main"> (b) <h2 class="red"> (c) <h1 id="logo"> (d) <h1 class="main">
-
9.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 16px;
}
} - 10.True or false: the border is a solid or dotted edge. (a) True (b) False
- 11.True or false: JavaScript adds space around boxes. (a) True (b) False
-
12.✍️ What value is given to font-size in this rule?
.box {
font-size: 20px;
background-color: yellow;
text-align: center;
font-weight: bold;
} (a) font-size (b) yellow (c) 20px (d) center -
13.⚖️ What colour is the text of this element?
<h2 class="big" id="hero">Hi</h2>
CSS:
h2 { color: orange; }
h2 { color: green; } (a) black (b) green (c) orange (d) yellow - 14.Which of these is margin? (a) the line round the box (b) the text or picture (c) space outside the border (d) a solid or dotted edge
-
15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} - 16.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
17.⚖️ What colour is the text of this element?
<h2 class="star" id="end">Hi</h2>
CSS:
#end { color: white; }
h2 { color: purple; }
.star { color: blue; } (a) purple (b) blue (c) red (d) white - 18.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
- 19.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) red (c) bright green (d) white
- 20.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
- 21.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
-
22.✍️ What is the selector in this CSS rule?
li {
text-align: center;
border: 2px solid;
} (a) li (b) 2px solid (c) body (d) text-align - 23.True or false: CSS makes a form box. (a) False (b) True
-
24.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
font-size: 20px;
margin: 10px;
color: red;
} -
25.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
h2 { color: white; }
#logo { color: purple; } (a) black (b) white (c) purple (d) orange -
26.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
#logo { color: purple; }
.red { color: orange; } (a) green (b) blue (c) purple (d) orange - 27.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
-
28.✍️ What is the selector in this CSS rule?
h2 {
font-style: italic;
color: red;
} (a) h1 (b) font-style (c) h2 (d) red - 29.🌈 Which hex code is black? (a) #0000ff (b) #00ff00 (c) #000000 (d) #ffffff
-
30.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
.red { color: black; }
#logo { color: red; } (a) blue (b) black (c) green (d) red -
31.✍️ What value is given to font-size in this rule?
p {
padding: 8px;
border: 2px solid;
font-size: 20px;
} (a) 20px (b) yellow (c) font-size (d) center - 32.🎯 Which sign starts an id selector? (a) # (b) @ (c) & (d) .
- 33.🌈 Which hex code is white? (a) #00ff00 (b) #ffffff (c) #ffff00 (d) #000000
- 34.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) background-color
- 35.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
-
36.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 37.🌈 In #620000 the red part is the hex number 62. What is it as a normal number?
- 38.🎨 Which attribute adds CSS inside one tag? (a) href (b) alt (c) style (d) src
- 39.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
-
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 200px;
padding: 10px;
border: 3px solid black;
margin: 0px;
}
Answer key
- <h1 class="big">
- background-color
- 60
- F
- magenta
- ;
- 50
- <h1 id="main">
- 16
- True
- False
- 20px
- green
- space outside the border
- 22
- an id selector
- white
- 800px or wider
- red
- flex-start
- color
- li
- False
- 3
- purple
- purple
- an element selector
- h2
- #000000
- red
- 20px
- #
- #ffffff
- font-family
- :
- Yes
- 98
- style
- 1
- 226
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids