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 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
-
2.✍️ Which property is set to red in this rule?
body {
text-align: center;
font-size: 20px;
color: red;
} (a) color (b) font-size (c) text-align (d) red -
3.⚖️ What colour is the text of this element?
<h1 class="menu" id="main">Hi</h1>
CSS:
.menu { color: red; }
.menu { color: yellow; } (a) orange (b) red (c) yellow (d) green - 4.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
-
5.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 26px;
}
} - 6.🌈 Which colour of light is strongest in rgb(129, 68, 171)? (a) green (b) red (c) blue
- 7.True or false: #logo is an id selector. (a) True (b) False
-
8.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} - 9.True or false: the content is space outside the border. (a) True (b) False
-
10.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 3px solid black;
margin: 5px;
} - 11.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
- 12.True or false: padding is the gap round content. (a) False (b) True
-
13.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 170px;
justify-content: space-between;
}
Inside are 2 boxes, each 50px wide (no margins). -
14.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} (a) No (b) Yes - 15.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <css> (d) <a>
- 16.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
- 17.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
- 18.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
19.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 600px) {
p {
font-size: 12px;
}
} (a) No (b) Yes -
20.✍️ Which property is set to 10px in this rule?
h2 {
margin: 10px;
font-weight: bold;
} (a) font-weight (b) padding (c) margin (d) 10px -
21.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 30px;
}
} (a) Yes (b) No -
22.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
.red { color: red; }
#logo { color: white; }
h1 { color: blue; } (a) white (b) blue (c) black (d) red - 23.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) blue (c) white (d) magenta
-
24.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
.menu { color: white; }
.menu { color: orange; } (a) orange (b) black (c) white (d) purple - 25.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
- 26.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) space-between (d) center
- 27.🔍 Which is the odd one out? (a) lays out the page (b) reacts to a button click (c) sets colours and fonts (d) rounds box corners
-
28.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} -
29.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: green; }
h1 { color: yellow; } (a) white (b) green (c) black (d) yellow -
30.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 80px;
padding: 25px;
border: 3px solid black;
margin: 10px;
} -
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 20px;
border: 1px solid black;
margin: 10px;
} - 32.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-size (d) font-family
- 33.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
- 34.True or false: #main is a class selector. (a) True (b) False
-
35.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: center;
}
Inside are 2 boxes, each 60px wide (no margins). - 36.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
- 37.Which of these does HTML do? (a) reacts to a button click (b) makes a form box (c) shows a pop-up message (d) changes the page live
-
38.⚖️ What colour is the text of this element?
<h2 class="box" id="intro">Hi</h2>
CSS:
#intro { color: blue; }
#intro { color: orange; } (a) blue (b) orange (c) green (d) purple -
39.🖌️ What colour are the letters?
li {
font-size: 32px;
text-align: left;
color: blue;
background-color: white;
} (a) blue (b) red (c) white - 40.🎨 One CSS file can style how many pages? (a) no pages (b) many pages (c) only one word (d) only one image
Answer key
- shows a pop-up message
- color
- yellow
- 800px or wider
- 26
- blue
- True
- 12
- False
- 116
- HTML
- True
- 70
- No
- <link>
- packs boxes at the start
- an element selector
- an element selector
- No
- margin
- Yes
- white
- blue
- orange
- content
- space-between
- reacts to a button click
- 130
- green
- 156
- 252
- font-family
- :
- False
- 20
- the later one
- makes a form box
- orange
- blue
- many pages
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids