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 colour of light is strongest in rgb(221, 76, 105)? (a) blue (b) red (c) green
-
2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 18px;
}
} -
3.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 260px;
justify-content: space-between;
}
Inside are 2 boxes, each 100px wide (no margins). - 4.💪 Which flexbox property sets space between boxes? (a) gap (b) display: flex (c) justify-content (d) align-items
-
5.🖌️ Where does the text sit on its line?
p {
font-size: 20px;
text-align: left;
color: purple;
background-color: red;
} (a) on the left (b) on the right (c) in the middle - 6.🌈 Which colour is rgb(255, 255, 255)? (a) red (b) white (c) yellow (d) cyan
-
7.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 190px;
justify-content: space-between;
}
Inside are 4 boxes, each 40px wide (no margins). - 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
-
9.✍️ How many declarations (property: value pairs) are in this rule?
li {
background-color: yellow;
padding: 8px;
border: 2px solid;
margin: 10px;
} - 10.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
- 11.🔍 Which is the odd one out? (a) makes a form box (b) shows a pop-up message (c) puts a picture on a page (d) gives the page structure
- 12.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
-
13.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 3 boxes, each 50px wide (no margins). - 14.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) centres a heading (d) makes the text bold
- 15.True or false: HTML sets colours and fonts. (a) True (b) False
- 16.🌈 Which colour of light is strongest in rgb(74, 234, 140)? (a) green (b) blue (c) red
-
17.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 280px;
justify-content: center;
}
Inside are 3 boxes, each 80px wide (no margins). - 18.True or false: .big is an id selector. (a) False (b) True
-
19.🎯 Which CSS selector matches this element?
<span class="note" id="main">Hello</span> (a) .big (b) #note (c) span (d) .main - 20.Which of these is the content? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) the gap round content
- 21.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
- 22.🌈 Which hex code is yellow? (a) #ff00ff (b) #00ff00 (c) #ffff00 (d) #ff0000
-
23.⚖️ What colour is the text of this element?
<h2 class="star" id="logo">Hi</h2>
CSS:
.star { color: purple; }
#logo { color: white; }
h2 { color: black; } (a) white (b) orange (c) black (d) purple - 24.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
- 25.✍️ In color: blue; which part is the property? (a) : (b) ; (c) blue (d) color
- 26.🌈 In #000011 the blue part is the hex number 11. What is it as a normal number?
- 27.🌈 In #300000 the red part is the hex number 30. What is it as a normal number?
-
28.🖌️ Where does the text sit on its line?
li {
background-color: orange;
font-size: 16px;
color: black;
text-align: right;
} (a) on the left (b) in the middle (c) on the right - 29.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
- 30.✍️ In color: blue; which part is the value? (a) ; (b) color (c) : (d) blue
- 31.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
- 32.True or false: JavaScript changes the page live. (a) False (b) True
-
33.⚖️ What colour is the text of this element?
<p class="note" id="intro">Hi</p>
CSS:
#intro { color: blue; }
.note { color: purple; }
p { color: white; } (a) white (b) green (c) purple (d) blue - 34.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 5 (d) 2
-
35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 250px;
padding: 5px;
border: 4px solid black;
margin: 20px;
} - 36.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) makes a link (d) makes headings and lists
- 37.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
- 38.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) cyan (c) yellow (d) white
- 39.🔍 Which is the odd one out? (a) makes a link (b) gives the page structure (c) adds space around boxes (d) puts a picture on a page
-
40.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 130px;
justify-content: flex-end;
}
Inside are 2 boxes, each 50px wide (no margins).
Answer key
- red
- 18
- 60
- gap
- on the left
- white
- 10
- the later one
- 4
- blue
- shows a pop-up message
- align-items
- 30
- centres a heading
- False
- green
- 20
- False
- span
- the text or picture
- an id selector
- #ffff00
- white
- border
- color
- 17
- 48
- on the right
- fits every screen
- blue
- Cascading Style Sheets
- True
- blue
- 1
- 268
- sets colours and fonts
- packs boxes at the start
- yellow
- adds space around boxes
- 30
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids