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.True or false: JavaScript makes a link. (a) False (b) True
-
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
3.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 6px;
}
} -
4.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 12px;
}
} (a) No (b) Yes -
5.🎯 Which CSS selector matches this element?
<h2 class="big" id="end">Hello</h2> (a) #big (b) li (c) .big (d) .red -
6.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 160px;
padding: 25px;
border: 1px solid black;
margin: 5px;
} - 7.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
- 8.True or false: #top is an element selector. (a) True (b) False
-
9.✍️ What value is given to font-weight in this rule?
h1 {
text-align: center;
color: red;
font-weight: bold;
} (a) font-weight (b) 2px solid (c) bold (d) 300px - 10.🎯 Which element does the selector .star style? (a) <h1 class="star"> (b) <h2 class="note"> (c) <h1 class="menu"> (d) <h1 id="star">
- 11.🔍 Which is the odd one out? (a) changes the text size (b) adds space around boxes (c) puts a picture on a page (d) sets colours and fonts
-
12.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 130px;
justify-content: space-between;
}
Inside are 2 boxes, each 60px wide (no margins). -
13.✍️ Which property is set to 20px in this rule?
.box {
margin: 10px;
font-size: 20px;
font-style: italic;
} (a) text-align (b) font-size (c) 20px (d) background-color -
14.✍️ What is the selector in this CSS rule?
p {
font-size: 20px;
text-align: center;
width: 300px;
} (a) font-size (b) p (c) .note (d) center - 15.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
- 16.True or false: JavaScript changes the page live. (a) True (b) False
-
17.✍️ What value is given to font-style in this rule?
h2 {
font-style: italic;
border: 2px solid;
} (a) font-style (b) 20px (c) red (d) italic -
18.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 4 boxes, each 40px wide (no margins). - 19.🌈 Which colour is #ff0000? (a) red (b) yellow (c) blue (d) cyan
-
20.✍️ What value is given to padding in this rule?
h1 {
border: 2px solid;
background-color: yellow;
font-style: italic;
padding: 8px;
} (a) 8px (b) padding (c) 2px solid (d) bold -
21.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 20px;
}
} (a) Yes (b) No -
22.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 600px) {
p {
font-size: 24px;
}
} (a) Yes (b) No - 23.🌈 In #00005d the blue part is the hex number 5d. What is it as a normal number?
-
24.🎯 Which CSS selector matches this element?
<p class="big" id="logo">Hello</p> (a) .red (b) #big (c) #logo (d) .logo - 25.📱 What does a media query check? (a) the battery level (b) the page title (c) the screen width (d) the time of day
- 26.True or false: the border is space inside the border. (a) True (b) False
-
27.🖌️ What colour is behind the letters?
li {
text-align: right;
color: blue;
background-color: white;
font-size: 12px;
} (a) white (b) blue (c) green -
28.✍️ What is the selector in this CSS rule?
h2 {
padding: 8px;
font-style: italic;
} (a) padding (b) h2 (c) italic (d) h1 - 29.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) text-align (d) font-size
- 30.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
-
31.🖌️ What colour are the letters?
h1 {
text-align: center;
font-size: 12px;
background-color: blue;
color: black;
} (a) white (b) black (c) blue -
32.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 14px;
}
} -
33.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) Yes (b) No -
34.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 24px;
}
} - 35.🎯 What kind of selector is body? (a) a class selector (b) an id selector (c) an element selector
- 36.🌈 Which colour of light is strongest in rgb(53, 170, 82)? (a) green (b) red (c) blue
- 37.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) bright green (c) white (d) blue
- 38.🌈 In #e10000 the red part is the hex number e1. What is it as a normal number?
- 39.🌈 In #1f0000 the red part is the hex number 1f. What is it as a normal number?
-
40.⚖️ What colour is the text of this element?
<p class="menu" id="end">Hi</p>
CSS:
.menu { color: yellow; }
.menu { color: purple; } (a) orange (b) purple (c) yellow (d) white
Answer key
- False
- 242
- 12
- Yes
- .big
- 222
- border
- False
- bold
- <h1 class="star">
- puts a picture on a page
- 10
- font-size
- p
- :
- True
- italic
- 70
- red
- 8px
- Yes
- No
- 93
- #logo
- the screen width
- False
- white
- h2
- text-align
- ;
- black
- 12
- No
- 20
- an element selector
- green
- bright green
- 225
- 31
- purple
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids