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: margin is space inside the border. (a) False (b) True
- 2.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
- 3.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
-
4.🖌️ Where does the text sit on its line?
li {
font-size: 28px;
color: white;
text-align: left;
background-color: black;
} (a) in the middle (b) on the left (c) on the right -
5.🎯 Which CSS selector matches this element?
<p class="red" id="intro">Hello</p> (a) .box (b) h1 (c) .red (d) #red - 6.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) lays out the page (d) puts a picture on a page
- 7.True or false: HTML makes headings and lists. (a) False (b) True
- 8.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
-
9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 480px) {
p {
font-size: 16px;
}
} -
10.✍️ How many declarations (property: value pairs) are in this rule?
#top {
background-color: yellow;
} -
11.✍️ What value is given to font-weight in this rule?
p {
width: 300px;
font-weight: bold;
} (a) 2px solid (b) bold (c) font-weight (d) 300px -
12.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 180px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). - 13.🌈 Which colour is #ff0000? (a) bright green (b) black (c) red (d) white
- 14.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) checks a quiz answer (d) puts a picture on a page
- 15.🎯 Which element does the selector #logo style? (a) <h2 class="logo"> (b) <h2 id="end"> (c) <h2 id="logo"> (d) <li class="big">
- 16.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
- 17.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) red (c) cyan (d) white
-
18.⚖️ What colour is the text of this element?
<h1 class="menu" id="hero">Hi</h1>
CSS:
.menu { color: black; }
.menu { color: blue; } (a) red (b) black (c) blue (d) purple - 19.📱 What does a media query check? (a) the page title (b) the battery level (c) the screen width (d) the time of day
- 20.🖌️ Which CSS property centres a heading? (a) background-color (b) font-size (c) text-align (d) font-weight
-
21.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
p { color: blue; }
p { color: white; } (a) white (b) purple (c) orange (d) blue -
22.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 6px;
}
} (a) Yes (b) No -
23.🖌️ What colour are the letters?
p {
font-size: 28px;
text-align: right;
color: orange;
background-color: white;
} (a) orange (b) red (c) white - 24.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
- 25.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
- 26.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the gap round content
-
27.🖌️ What colour are the letters?
h1 {
font-size: 24px;
background-color: yellow;
color: blue;
text-align: right;
} (a) blue (b) yellow (c) red - 28.🌈 Which hex code is cyan? (a) #ffffff (b) #0000ff (c) #00ff00 (d) #00ffff
- 29.🎯 Which element does the selector span style? (a) <h2 id="hero"> (b) <p> (c) <h1 class="menu"> (d) <span class="menu">
- 30.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
- 31.🎯 Which element does the selector li style? (a) <li class="menu"> (b) <div> (c) <p id="main"> (d) <span class="menu">
- 32.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
-
33.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 50px;
padding: 25px;
border: 1px solid black;
margin: 15px;
} -
34.🖌️ How big is the text, in px?
h2 {
font-size: 40px;
background-color: yellow;
text-align: right;
color: black;
} - 35.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
-
36.🎯 Which CSS selector matches this element?
<div class="box" id="main">Hello</div> (a) div (b) #box (c) span (d) #logo -
37.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
.red { color: white; }
.red { color: orange; } (a) white (b) orange (c) yellow (d) purple - 38.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
-
39.🖌️ What colour are the letters?
h1 {
color: white;
background-color: orange;
text-align: right;
font-size: 24px;
} (a) white (b) orange (c) yellow -
40.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 100px;
padding: 30px;
border: 2px solid black;
margin: 0px;
}
Answer key
- False
- an element selector
- .
- on the left
- .red
- lays out the page
- True
- an id selector
- 16
- 1
- bold
- 60
- red
- checks a quiz answer
- <h2 id="logo">
- flex-end
- white
- blue
- the screen width
- text-align
- white
- No
- orange
- an id selector
- 255
- a solid or dotted edge
- blue
- #00ffff
- <span class="menu">
- HTML
- <li class="menu">
- /*
- 132
- 40
- <style>
- div
- orange
- red
- white
- 164
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids