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: 10px;
border: 4px solid black;
margin: 0px;
} - 2.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
-
3.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
.box { color: black; }
p { color: purple; }
#intro { color: blue; } (a) black (b) purple (c) green (d) blue - 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) J (d) F
- 5.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 100 (d) 1000
-
6.⚖️ What colour is the text of this element?
<p class="red" id="intro">Hi</p>
CSS:
#intro { color: yellow; }
#intro { color: black; } (a) yellow (b) black (c) purple (d) red -
7.🖌️ What colour are the letters?
h1 {
text-align: center;
color: blue;
font-size: 40px;
background-color: red;
} (a) red (b) black (c) blue - 8.💪 Which flexbox property turns on flexbox? (a) display: flex (b) align-items (c) flex-direction (d) gap
- 9.🧩 Which language reacts to a button click? (a) JavaScript (b) CSS (c) HTML
- 10.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
- 11.🌈 Which colour of light is strongest in rgb(109, 132, 157)? (a) red (b) green (c) blue
-
12.⚖️ What colour is the text of this element?
<h1 class="box" id="hero">Hi</h1>
CSS:
h1 { color: yellow; }
#hero { color: purple; }
.box { color: orange; } (a) purple (b) orange (c) yellow (d) black - 13.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Cascading Style Sheets
-
14.✍️ What value is given to background-color in this rule?
.note {
border: 2px solid;
font-style: italic;
background-color: yellow;
margin: 10px;
} (a) 10px (b) background-color (c) yellow (d) 8px - 15.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
- 16.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
- 17.True or false: padding is a solid or dotted edge. (a) False (b) True
- 18.Which of these is margin? (a) the text or picture (b) the gap round content (c) a solid or dotted edge (d) space outside the border
- 19.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-family (c) text-align (d) color
- 20.🌈 Which colour of light is strongest in rgb(136, 201, 33)? (a) red (b) green (c) blue
- 21.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) bright green (c) magenta (d) white
- 22.🎯 What kind of selector is img? (a) an element selector (b) a class selector (c) an id selector
- 23.🎯 What kind of selector is .star? (a) a class selector (b) an element selector (c) an id selector
- 24.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 6 (d) 2
- 25.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) exactly 1000px (d) turned off
-
26.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
.menu { color: blue; }
.menu { color: red; } (a) yellow (b) white (c) red (d) blue - 27.🌈 Which colour is #ff0000? (a) white (b) red (c) black (d) blue
- 28.🌈 In #004900 the green part is the hex number 49. What is it as a normal number?
- 29.🖌️ Which CSS property makes the text bold? (a) font-family (b) font-size (c) text-align (d) font-weight
- 30.True or false: .big is an id selector. (a) True (b) False
- 31.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
- 32.True or false: CSS counts down a timer. (a) True (b) False
-
33.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 300px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 34.📦 In the box model, which part is the gap to other boxes? (a) margin (b) border (c) padding (d) content
- 35.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
-
36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} -
37.✍️ How many declarations (property: value pairs) are in this rule?
.box {
font-style: italic;
padding: 8px;
background-color: yellow;
} - 38.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
- 39.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
-
40.✍️ How many declarations (property: value pairs) are in this rule?
p {
font-size: 20px;
text-align: center;
}
Answer key
- 158
- JavaScript
- blue
- F
- 255
- black
- blue
- display: flex
- JavaScript
- border
- blue
- purple
- Cascading Style Sheets
- yellow
- red
- <link>
- False
- space outside the border
- color
- green
- bright green
- an element selector
- a class selector
- 3
- 600px or narrower
- red
- red
- 73
- font-weight
- False
- flex-end
- False
- 60
- margin
- .
- 12
- 3
- packs boxes at the start
- the screen width
- 2
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids