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 is the selector in this CSS rule?
.box {
padding: 8px;
font-style: italic;
font-weight: bold;
font-size: 20px;
} (a) padding (b) italic (c) h2 (d) .box - 2.🧩 Which language lays out the page? (a) JavaScript (b) HTML (c) CSS
-
3.🖌️ What colour are the letters?
h1 {
text-align: left;
color: blue;
background-color: orange;
font-size: 24px;
} (a) blue (b) purple (c) orange - 4.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
- 5.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-weight (d) color
-
6.🎯 Which CSS selector matches this element?
<p class="box" id="main">Hello</p> (a) .star (b) h1 (c) #box (d) p - 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
- 8.What does background-color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
- 9.🎨 Which attribute adds CSS inside one tag? (a) src (b) style (c) href (d) alt
-
10.✍️ Which property is set to yellow in this rule?
h1 {
background-color: yellow;
font-size: 20px;
} (a) padding (b) margin (c) background-color (d) yellow - 11.What does color do? (a) makes the text bold (b) centres a heading (c) picks the font style (d) sets the letter colour
- 12.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
- 13.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
-
14.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 90px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins). - 15.True or false: h1 is a class selector. (a) False (b) True
- 16.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) background-color (d) font-size
- 17.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) only one word (d) many pages
-
18.✍️ How many declarations (property: value pairs) are in this rule?
#top {
font-style: italic;
font-size: 20px;
font-weight: bold;
margin: 10px;
} -
19.✍️ Which property is set to red in this rule?
h1 {
color: red;
border: 2px solid;
} (a) text-align (b) font-size (c) red (d) color - 20.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 3 (d) 2
-
21.🖌️ What colour are the letters?
li {
background-color: orange;
font-size: 16px;
color: black;
text-align: right;
} (a) black (b) green (c) orange - 22.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
- 23.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) makes the text bold (d) sets the letter colour
-
24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 32px;
}
} -
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 140px;
justify-content: center;
}
Inside are 2 boxes, each 50px wide (no margins). -
26.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 300px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} - 27.🎯 Can many elements share the same class? (a) Yes (b) No
-
28.🖌️ How big is the text, in px?
h1 {
font-size: 36px;
background-color: green;
color: yellow;
text-align: center;
} - 29.Which of these does HTML do? (a) changes the text size (b) makes a form box (c) changes the page live (d) adds space around boxes
-
30.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 310px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). - 31.True or false: #logo is an id selector. (a) False (b) True
- 32.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
- 33.🌈 Which hex code is blue? (a) #000000 (b) #00ffff (c) #0000ff (d) #ff0000
- 34.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
-
35.⚖️ What colour is the text of this element?
<p class="big" id="main">Hi</p>
CSS:
p { color: black; }
p { color: purple; } (a) white (b) red (c) black (d) purple - 36.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <script> (d) <css>
-
37.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: center;
}
Inside are 2 boxes, each 80px wide (no margins). - 38.True or false: JavaScript counts down a timer. (a) True (b) False
- 39.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Cascading Style Sheets
- 40.🌈 Which hex code is red? (a) #0000ff (b) #ffffff (c) #ff0000 (d) #00ff00
Answer key
- .box
- CSS
- blue
- 800px or wider
- background-color
- p
- the later one
- colours behind the text
- style
- background-color
- sets the letter colour
- a class selector
- 600px or narrower
- 10
- False
- text-align
- many pages
- 4
- color
- 3
- black
- blue
- makes the text bold
- 24
- 20
- 362
- Yes
- 36
- makes a form box
- 70
- True
- a class selector
- #0000ff
- an element selector
- purple
- <style>
- 10
- True
- Cascading Style Sheets
- #ff0000
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids