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.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
.box { color: blue; }
.box { color: orange; } (a) black (b) white (c) blue (d) orange -
2.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-style: italic;
margin: 10px;
} -
3.✍️ How many declarations (property: value pairs) are in this rule?
.note {
font-style: italic;
width: 300px;
font-size: 20px;
text-align: center;
} -
4.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
.box { color: purple; }
p { color: green; } (a) blue (b) green (c) white (d) purple - 5.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
-
6.🖌️ How big is the text, in px?
li {
color: blue;
font-size: 12px;
background-color: yellow;
text-align: center;
} - 7.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-weight (c) font-size (d) font-family
-
8.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 330px;
justify-content: flex-end;
}
Inside are 3 boxes, each 100px wide (no margins). - 9.🌈 In #000002 the blue part is the hex number 02. What is it as a normal number?
- 10.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
11.✍️ What is the selector in this CSS rule?
#top {
border: 2px solid;
font-style: italic;
padding: 8px;
} (a) #top (b) li (c) italic (d) border - 12.True or false: padding is space inside the border. (a) False (b) True
- 13.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
- 14.🔍 Which is the odd one out? (a) lays out the page (b) changes the page live (c) rounds box corners (d) changes the text size
- 15.🎯 Can many elements share the same class? (a) Yes (b) No
-
16.✍️ What value is given to padding in this rule?
.box {
color: red;
padding: 8px;
border: 2px solid;
margin: 10px;
} (a) bold (b) padding (c) 8px (d) 2px solid - 17.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
- 18.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
- 19.🖌️ Which CSS property colours behind the text? (a) font-family (b) font-size (c) background-color (d) font-weight
- 20.🌈 Which colour is #ff00ff? (a) cyan (b) blue (c) magenta (d) white
- 21.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
-
22.✍️ How many declarations (property: value pairs) are in this rule?
body {
background-color: yellow;
border: 2px solid;
} -
23.✍️ What value is given to font-weight in this rule?
h1 {
background-color: yellow;
font-weight: bold;
font-style: italic;
} (a) font-weight (b) bold (c) 2px solid (d) 300px -
24.🖌️ How big is the text, in px?
p {
color: green;
text-align: right;
font-size: 32px;
background-color: purple;
} -
25.✍️ Which property is set to center in this rule?
.box {
border: 2px solid;
text-align: center;
} (a) margin (b) background-color (c) center (d) text-align -
26.✍️ How many declarations (property: value pairs) are in this rule?
body {
font-size: 20px;
background-color: yellow;
} - 27.🔍 Which is the odd one out? (a) gives the page structure (b) shows a pop-up message (c) makes a link (d) puts a picture on a page
-
28.🖌️ Where does the text sit on its line?
h2 {
font-size: 32px;
text-align: right;
color: red;
background-color: white;
} (a) in the middle (b) on the right (c) on the left - 29.🎯 Which element does the selector .big style? (a) <h1 class="box"> (b) <p class="red"> (c) <p id="big"> (d) <p class="big">
-
30.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
h1 { color: blue; }
#top { color: red; }
.red { color: purple; } (a) red (b) purple (c) blue (d) white - 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) G (c) Z (d) J
- 32.Which of these does JavaScript do? (a) lays out the page (b) adds space around boxes (c) gives the page structure (d) counts down a timer
- 33.🎯 Which element does the selector #top style? (a) <p class="top"> (b) <p id="top"> (c) <h1 class="note"> (d) <p id="intro">
-
34.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 14px;
}
} (a) Yes (b) No - 35.What does font-weight do? (a) sets the letter colour (b) picks the font style (c) makes the text bold (d) makes letters bigger
- 36.🌈 In #00001a the blue part is the hex number 1a. What is it as a normal number?
-
37.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
.note { color: yellow; }
.note { color: white; } (a) green (b) yellow (c) white (d) blue - 38.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) space-between (c) center (d) flex-end
-
39.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 530px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). -
40.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
.menu { color: blue; }
#logo { color: red; } (a) orange (b) red (c) white (d) blue
Answer key
- orange
- 2
- 4
- purple
- blue
- 12
- font-size
- 30
- 2
- an id selector
- #top
- True
- a class selector
- changes the page live
- Yes
- 8px
- 600px or narrower
- packs boxes at the start
- background-color
- magenta
- display: flex
- 2
- bold
- 32
- text-align
- 2
- shows a pop-up message
- on the right
- <p class="big">
- red
- F
- counts down a timer
- <p id="top">
- Yes
- makes the text bold
- 26
- white
- space-between
- 70
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids