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 tag connects an outside CSS file? (a) <a> (b) <img> (c) <link> (d) <css>
-
2.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 180px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} -
3.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} -
4.🖌️ What colour are the letters?
li {
background-color: yellow;
font-size: 36px;
text-align: right;
color: green;
} (a) yellow (b) white (c) green -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 15px;
border: 5px solid black;
margin: 0px;
} -
6.⚖️ What colour is the text of this element?
<h2 class="red" id="logo">Hi</h2>
CSS:
.red { color: green; }
#logo { color: black; }
h2 { color: purple; } (a) orange (b) green (c) black (d) purple - 7.🔍 Which is the odd one out? (a) reacts to a button click (b) lays out the page (c) checks a quiz answer (d) changes the page live
- 8.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) margin (d) content
- 9.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
-
10.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
h1 { color: orange; }
h1 { color: black; } (a) green (b) black (c) orange (d) blue - 11.Which of these does JavaScript do? (a) adds space around boxes (b) counts down a timer (c) gives the page structure (d) puts a picture on a page
-
12.🖌️ Where does the text sit on its line?
h1 {
font-size: 32px;
background-color: orange;
color: green;
text-align: right;
} (a) in the middle (b) on the right (c) on the left - 13.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
-
14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 270px;
padding: 20px;
border: 3px solid black;
margin: 15px;
} - 15.🎯 Which sign starts an id selector? (a) @ (b) # (c) . (d) &
-
16.⚖️ What colour is the text of this element?
<h2 class="star" id="intro">Hi</h2>
CSS:
.star { color: purple; }
.star { color: green; } (a) white (b) green (c) yellow (d) purple - 17.🌈 Which hex code is red? (a) #ffffff (b) #ff00ff (c) #ff0000 (d) #00ff00
- 18.✍️ How does a CSS comment start? (a) // (b) # (c) <!-- (d) /*
- 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) the shorter one (d) neither
- 20.✍️ In color: blue; which part is the value? (a) : (b) blue (c) ; (d) color
- 21.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
- 22.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
- 23.🎯 Can many elements share the same class? (a) Yes (b) No
- 24.🌈 Which colour is #000000? (a) red (b) magenta (c) black (d) bright green
-
25.✍️ Which property is set to 20px in this rule?
body {
font-style: italic;
font-size: 20px;
color: red;
} (a) background-color (b) font-size (c) text-align (d) 20px - 26.True or false: #logo is a class selector. (a) True (b) False
- 27.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a form box (c) counts down a timer (d) shows a pop-up message
- 28.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 1000 (d) 100
- 29.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) G (d) Z
- 30.🌈 In #e30000 the red part is the hex number e3. What is it as a normal number?
-
31.⚖️ What colour is the text of this element?
<p class="star" id="top">Hi</p>
CSS:
#top { color: blue; }
#top { color: black; } (a) orange (b) black (c) white (d) blue -
32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 70px;
padding: 10px;
border: 5px solid black;
margin: 10px;
} - 33.🎯 Which element does the selector div style? (a) <div class="menu"> (b) <p class="menu"> (c) <h1 id="top"> (d) <span>
- 34.True or false: CSS puts a picture on a page. (a) False (b) True
- 35.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-end (c) space-between (d) flex-start
- 36.Which of these is margin? (a) a solid or dotted edge (b) space outside the border (c) the gap round content (d) the text or picture
-
37.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 260px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} - 38.True or false: JavaScript gives the page structure. (a) False (b) True
- 39.🎯 Which element does the selector #end style? (a) <h1 class="end"> (b) <h2 class="menu"> (c) <h1 id="hero"> (d) <h1 id="end">
-
40.✍️ Which property is set to red in this rule?
h2 {
font-size: 20px;
color: red;
font-weight: bold;
font-style: italic;
} (a) font-size (b) red (c) color (d) text-align
Answer key
- <link>
- 214
- 16
- green
- 300
- black
- lays out the page
- margin
- a class selector
- black
- counts down a timer
- on the right
- packs boxes at the start
- 316
- #
- green
- #ff0000
- /*
- the later one
- blue
- equal gaps, none at ends
- the screen width
- Yes
- black
- font-size
- False
- makes a form box
- 255
- F
- 227
- black
- 100
- <div class="menu">
- False
- space-between
- space outside the border
- 326
- False
- <h1 id="end">
- color
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids