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 hex code is cyan? (a) #000000 (b) #ffff00 (c) #00ff00 (d) #00ffff
-
2.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 280px;
justify-content: flex-start;
}
Inside are 4 boxes, each 50px wide (no margins). - 3.📦 In the box model, which part is the gap to other boxes? (a) content (b) border (c) margin (d) padding
- 4.🔍 Which is the odd one out? (a) checks a quiz answer (b) shows a pop-up message (c) adds space around boxes (d) changes the page live
- 5.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) center (d) flex-start
-
6.🖌️ What colour is behind the letters?
p {
font-size: 32px;
text-align: left;
color: yellow;
background-color: black;
} (a) black (b) yellow (c) green - 7.🎯 What kind of selector is p? (a) a class selector (b) an element selector (c) an id selector
-
8.🎯 Which CSS selector matches this element?
<li class="big" id="top">Hello</li> (a) #big (b) .big (c) .top (d) div - 9.🎯 Which element does the selector #logo style? (a) <h1 class="box"> (b) <p class="logo"> (c) <p id="end"> (d) <p id="logo">
-
10.🖌️ What colour are the letters?
p {
text-align: left;
font-size: 40px;
background-color: blue;
color: green;
} (a) green (b) red (c) blue - 11.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) red (d) green
-
12.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 230px;
justify-content: flex-start;
}
Inside are 2 boxes, each 100px wide (no margins). -
13.⚖️ What colour is the text of this element?
<p class="red" id="hero">Hi</p>
CSS:
p { color: white; }
.red { color: blue; }
#hero { color: purple; } (a) white (b) purple (c) red (d) blue -
14.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes -
15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 480px) {
p {
font-size: 20px;
}
} -
16.✍️ What value is given to text-align in this rule?
#top {
text-align: center;
padding: 8px;
} (a) text-align (b) center (c) yellow (d) 10px - 17.🖌️ Which CSS property picks the font style? (a) background-color (b) font-size (c) text-align (d) font-family
-
18.⚖️ What colour is the text of this element?
<h1 class="box" id="main">Hi</h1>
CSS:
.box { color: white; }
.box { color: purple; } (a) yellow (b) black (c) white (d) purple - 19.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
- 20.🎯 What kind of selector is #main? (a) an element selector (b) an id selector (c) a class selector
- 21.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
- 22.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) shows a pop-up message (d) makes a link
- 23.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) only one image (d) many pages
- 24.🎯 Which element does the selector #intro style? (a) <h2 class="intro"> (b) <h2 id="main"> (c) <li class="note"> (d) <h2 id="intro">
-
25.🎯 Which CSS selector matches this element?
<p class="box" id="top">Hello</p> (a) #box (b) .star (c) .top (d) .box -
26.⚖️ What colour is the text of this element?
<p class="star" id="hero">Hi</p>
CSS:
#hero { color: orange; }
#hero { color: black; } (a) black (b) red (c) orange (d) yellow -
27.✍️ How many declarations (property: value pairs) are in this rule?
li {
background-color: yellow;
font-size: 20px;
font-weight: bold;
color: red;
} - 28.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
-
29.✍️ Which property is set to 8px in this rule?
h2 {
background-color: yellow;
padding: 8px;
font-style: italic;
font-weight: bold;
} (a) border (b) font-weight (c) padding (d) 8px - 30.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :
- 31.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
- 32.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
- 33.Which of these does CSS do? (a) shows a pop-up message (b) makes a form box (c) rounds box corners (d) makes a link
- 34.🎯 Which element does the selector #main style? (a) <span class="main"> (b) <p class="big"> (c) <span id="main"> (d) <span id="logo">
- 35.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
-
36.🎯 Which CSS selector matches this element?
<h2 class="red" id="end">Hello</h2> (a) li (b) #hero (c) h2 (d) .box -
37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 25px;
border: 3px solid black;
margin: 20px;
} -
38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} - 39.🌈 In #350000 the red part is the hex number 35. What is it as a normal number?
-
40.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 40px wide (no margins).
Answer key
- #00ffff
- 80
- margin
- adds space around boxes
- flex-end
- black
- an element selector
- .big
- <p id="logo">
- green
- blue
- 30
- purple
- Yes
- 24
- center
- font-family
- purple
- F
- an id selector
- red
- shows a pop-up message
- many pages
- <h2 id="intro">
- .box
- black
- 4
- fits every screen
- padding
- blue
- 800px or wider
- JavaScript
- rounds box corners
- <span id="main">
- JavaScript
- h2
- 356
- 24
- 53
- 50
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids