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 flexbox property turns on flexbox? (a) display: flex (b) gap (c) flex-direction (d) justify-content
- 2.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
-
3.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 560px;
justify-content: space-between;
}
Inside are 4 boxes, each 80px wide (no margins). - 4.🎯 Which sign starts an id selector? (a) & (b) # (c) . (d) @
- 5.🎯 What kind of selector is #hero? (a) an element selector (b) a class selector (c) an id selector
- 6.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
- 7.True or false: JavaScript makes a link. (a) False (b) True
-
8.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 260px;
justify-content: center;
}
Inside are 3 boxes, each 40px wide (no margins). - 9.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) flex-direction (d) align-items
- 10.What does color do? (a) sets the letter colour (b) makes the text bold (c) colours behind the text (d) picks the font style
-
11.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 240px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). - 12.🌈 In #007d00 the green part is the hex number 7d. What is it as a normal number?
- 13.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) font-size (d) background-color
- 14.🎯 Can many elements share the same class? (a) No (b) Yes
- 15.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) cyan (c) magenta (d) black
-
16.⚖️ What colour is the text of this element?
<h1 class="box" id="end">Hi</h1>
CSS:
.box { color: yellow; }
.box { color: blue; } (a) yellow (b) red (c) purple (d) blue - 17.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) blue (c) red (d) cyan
- 18.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) blue (c) bright green (d) red
- 19.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
- 20.🌈 Which colour of light is strongest in rgb(200, 82, 122)? (a) blue (b) green (c) red
-
21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} - 22.True or false: #main is an element selector. (a) False (b) True
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 90px;
padding: 25px;
border: 2px solid black;
margin: 10px;
} - 24.🎯 Which element does the selector h2 style? (a) <div class="menu"> (b) <h2 class="menu"> (c) <li> (d) <span id="end">
- 25.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
-
26.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
27.🖌️ What colour are the letters?
p {
color: red;
font-size: 36px;
text-align: right;
background-color: yellow;
} (a) purple (b) yellow (c) red - 28.True or false: JavaScript reacts to a button click. (a) False (b) True
- 29.True or false: margin is the gap to other boxes. (a) False (b) True
- 30.🌈 Which hex code is white? (a) #ffff00 (b) #00ffff (c) #00ff00 (d) #ffffff
-
31.🖌️ What colour are the letters?
p {
text-align: left;
color: black;
font-size: 20px;
background-color: purple;
} (a) red (b) black (c) purple - 32.🌈 In #0000b4 the blue part is the hex number b4. What is it as a normal number?
-
33.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} (a) Yes (b) No -
34.⚖️ What colour is the text of this element?
<h1 class="box" id="top">Hi</h1>
CSS:
#top { color: white; }
.box { color: blue; } (a) purple (b) white (c) blue (d) red - 35.True or false: padding is space inside the border. (a) False (b) True
- 36.True or false: h1 is a class selector. (a) True (b) False
- 37.What does background-color do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) picks the font style
- 38.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 39.Which of these does CSS do? (a) makes a link (b) makes a form box (c) changes the text size (d) counts down a timer
- 40.🖌️ Which CSS property centres a heading? (a) font-weight (b) color (c) text-align (d) font-family
Answer key
- display: flex
- padding
- 80
- #
- an id selector
- Cascading Style Sheets
- False
- 70
- justify-content
- sets the letter colour
- 60
- 125
- font-family
- Yes
- black
- blue
- blue
- bright green
- flex-end
- red
- 12
- False
- 164
- <h2 class="menu">
- /*
- 10
- red
- True
- True
- #ffffff
- black
- 180
- No
- white
- True
- False
- colours behind the text
- CSS
- changes the text size
- text-align
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids