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.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) blue (d) green
-
2.🖌️ What colour are the letters?
p {
color: green;
text-align: center;
background-color: orange;
font-size: 20px;
} (a) orange (b) green (c) red -
3.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 190px;
padding: 15px;
border: 1px solid black;
margin: 10px;
} - 4.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
- 5.True or false: CSS makes a form box. (a) False (b) True
- 6.🌈 Which hex code is bright green? (a) #000000 (b) #0000ff (c) #00ff00 (d) #ff0000
- 7.True or false: body is an element selector. (a) True (b) False
-
8.🖌️ What colour is behind the letters?
h2 {
font-size: 36px;
background-color: orange;
color: red;
text-align: left;
} (a) orange (b) red (c) yellow - 9.Which of these does HTML do? (a) rounds box corners (b) puts a picture on a page (c) adds space around boxes (d) changes the text size
- 10.🎯 Which element does the selector div style? (a) <span> (b) <div class="big"> (c) <p class="big"> (d) <h1 id="main">
-
11.🎯 Which CSS selector matches this element?
<div class="box" id="logo">Hello</div> (a) .star (b) #box (c) #logo (d) #end -
12.⚖️ What colour is the text of this element?
<p class="box" id="top">Hi</p>
CSS:
#top { color: purple; }
p { color: green; }
.box { color: black; } (a) green (b) purple (c) black (d) blue -
13.🎯 Which CSS selector matches this element?
<h2 class="box" id="intro">Hello</h2> (a) #main (b) .star (c) li (d) h2 - 14.Which of these is the border? (a) space outside the border (b) the text or picture (c) a solid or dotted edge (d) the gap round content
-
15.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 16px;
}
} (a) Yes (b) No - 16.Which of these does HTML do? (a) reacts to a button click (b) adds space around boxes (c) makes a form box (d) lays out the page
- 17.🌈 Which colour of light is strongest in rgb(251, 77, 88)? (a) red (b) green (c) blue
- 18.🌈 In #000089 the blue part is the hex number 89. What is it as a normal number?
- 19.🌈 Which colour is #00ffff? (a) magenta (b) red (c) cyan (d) white
- 20.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
-
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 25px;
border: 3px solid black;
margin: 15px;
} - 22.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
-
23.🎯 Which CSS selector matches this element?
<li class="menu" id="main">Hello</li> (a) .note (b) #menu (c) li (d) .main - 24.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) black (c) white (d) yellow
- 25.True or false: JavaScript makes headings and lists. (a) False (b) True
- 26.🌈 Which colour of light is strongest in rgb(248, 135, 110)? (a) green (b) red (c) blue
-
27.✍️ Which property is set to 8px in this rule?
body {
padding: 8px;
font-weight: bold;
font-size: 20px;
border: 2px solid;
} (a) font-weight (b) 8px (c) border (d) padding - 28.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
- 29.🎨 Which attribute adds CSS inside one tag? (a) style (b) href (c) alt (d) src
- 30.🎯 Which element does the selector .menu style? (a) <li class="menu"> (b) <li id="menu"> (c) <li class="note"> (d) <div class="big">
- 31.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
- 32.True or false: CSS checks a quiz answer. (a) False (b) True
- 33.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
-
34.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 30px;
border: 5px solid black;
margin: 0px;
} -
35.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
.menu { color: white; }
.menu { color: purple; } (a) green (b) white (c) black (d) purple - 36.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
-
37.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
} - 38.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) puts a picture on a page (d) makes headings and lists
-
39.💪 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). - 40.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) changes the text size (d) puts a picture on a page
Answer key
- blue
- green
- 242
- ;
- False
- #00ff00
- True
- orange
- puts a picture on a page
- <div class="big">
- #logo
- purple
- h2
- a solid or dotted edge
- No
- makes a form box
- red
- 137
- cyan
- HTML
- 196
- 255
- li
- red
- False
- red
- padding
- flex-end
- style
- <li class="menu">
- { }
- False
- fits every screen
- 140
- purple
- space-between
- 1
- adds space around boxes
- 50
- changes the text size
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids