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.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 600px) {
p {
font-size: 28px;
}
} (a) No (b) Yes - 2.Which of these is padding? (a) space inside the border (b) the line round the box (c) a solid or dotted edge (d) the gap to other boxes
- 3.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) - (d) =
- 4.Which of these does HTML do? (a) puts a picture on a page (b) changes the page live (c) changes the text size (d) lays out the page
-
5.⚖️ What colour is the text of this element?
<p class="star" id="end">Hi</p>
CSS:
.star { color: white; }
p { color: yellow; } (a) yellow (b) white (c) green (d) black - 6.True or false: CSS changes the text size. (a) False (b) True
-
7.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
#end { color: blue; }
#end { color: red; } (a) yellow (b) red (c) blue (d) black - 8.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
-
9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} -
10.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) No (b) Yes -
11.⚖️ What colour is the text of this element?
<h2 class="menu" id="logo">Hi</h2>
CSS:
.menu { color: green; }
.menu { color: blue; } (a) black (b) blue (c) purple (d) green - 12.🎯 What kind of selector is #top? (a) an element selector (b) a class selector (c) an id selector
-
13.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
color: red;
background-color: yellow;
margin: 10px;
} - 14.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-weight (c) font-family (d) text-align
- 15.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
- 16.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 2 (c) 4 (d) 3
-
17.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 10px;
border: 1px solid black;
margin: 20px;
} -
18.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
.note { color: blue; }
p { color: green; }
#hero { color: white; } (a) blue (b) green (c) red (d) white -
19.✍️ What is the selector in this CSS rule?
p {
font-size: 20px;
border: 2px solid;
width: 300px;
} (a) 2px solid (b) p (c) .note (d) font-size - 20.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
- 21.True or false: padding is space inside the border. (a) True (b) False
- 22.🌈 Which hex code is bright green? (a) #ffffff (b) #ffff00 (c) #00ff00 (d) #0000ff
-
23.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} - 24.True or false: #end is an id selector. (a) True (b) False
-
25.✍️ What value is given to font-style in this rule?
#top {
background-color: yellow;
font-weight: bold;
font-style: italic;
} (a) 20px (b) italic (c) font-style (d) red -
26.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 27.🎯 Which element does the selector #intro style? (a) <li class="intro"> (b) <li id="intro"> (c) <li id="main"> (d) <div class="menu">
-
28.✍️ How many declarations (property: value pairs) are in this rule?
.note {
color: red;
background-color: yellow;
} -
29.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 250px;
justify-content: flex-start;
}
Inside are 3 boxes, each 80px wide (no margins). -
30.✍️ What value is given to color in this rule?
h1 {
color: red;
margin: 10px;
background-color: yellow;
border: 2px solid;
} (a) 20px (b) red (c) center (d) color -
31.⚖️ What colour is the text of this element?
<h2 class="red" id="main">Hi</h2>
CSS:
#main { color: blue; }
.red { color: green; } (a) green (b) black (c) yellow (d) blue - 32.True or false: the content is the text or picture. (a) False (b) True
- 33.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
- 34.True or false: JavaScript makes a link. (a) False (b) True
-
35.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
.red { color: green; }
p { color: blue; }
#logo { color: orange; } (a) red (b) blue (c) orange (d) green -
36.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 22px;
}
} -
37.✍️ What is the selector in this CSS rule?
.note {
font-weight: bold;
text-align: center;
} (a) center (b) #top (c) .note (d) font-weight - 38.🌈 Which colour is #ff00ff? (a) magenta (b) white (c) black (d) yellow
- 39.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
- 40.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) red (c) green (d) white
Answer key
- No
- space inside the border
- :
- puts a picture on a page
- white
- True
- red
- { }
- 22
- No
- blue
- an id selector
- 3
- font-weight
- an id selector
- 3
- 182
- white
- p
- packs boxes at the end
- True
- #00ff00
- 10
- True
- italic
- 116
- <li id="intro">
- 2
- 10
- red
- blue
- True
- ;
- False
- orange
- 16
- .note
- magenta
- packs boxes at the start
- blue
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids