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.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) no pages (d) only one word
-
2.⚖️ What colour is the text of this element?
<h2 class="menu" id="main">Hi</h2>
CSS:
.menu { color: yellow; }
#main { color: black; }
h2 { color: purple; } (a) black (b) purple (c) yellow (d) white - 3.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) gap (d) align-items
-
4.🎯 Which CSS selector matches this element?
<h1 class="note" id="top">Hello</h1> (a) .top (b) .big (c) h2 (d) #top - 5.✍️ In color: blue; which part is the property? (a) color (b) blue (c) ; (d) :
- 6.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) ( ) (d) < >
-
7.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
h1 { color: black; }
h1 { color: purple; } (a) purple (b) green (c) black (d) white - 8.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) background-color (d) text-align
- 9.🖌️ Which CSS property colours behind the text? (a) text-align (b) color (c) font-size (d) background-color
- 10.🌈 Which hex code is blue? (a) #0000ff (b) #ff0000 (c) #ffff00 (d) #00ffff
- 11.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
- 12.💪 Which flexbox property picks row or column? (a) justify-content (b) display: flex (c) flex-direction (d) align-items
- 13.True or false: padding is space inside the border. (a) False (b) True
- 14.Which of these is margin? (a) the gap to other boxes (b) the gap round content (c) a solid or dotted edge (d) the line round the box
- 15.🎯 Which element does the selector span style? (a) <span class="red"> (b) <p> (c) <h1 class="red"> (d) <h2 id="top">
- 16.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <div class="note"> (c) <li class="top"> (d) <li id="top">
-
17.✍️ What value is given to color in this rule?
#top {
font-style: italic;
padding: 8px;
color: red;
margin: 10px;
} (a) center (b) 20px (c) color (d) red - 18.True or false: padding is the line round the box. (a) False (b) True
- 19.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
-
20.⚖️ What colour is the text of this element?
<p class="star" id="main">Hi</p>
CSS:
p { color: orange; }
p { color: red; } (a) blue (b) orange (c) red (d) yellow -
21.⚖️ What colour is the text of this element?
<p class="red" id="top">Hi</p>
CSS:
p { color: red; }
p { color: purple; } (a) purple (b) yellow (c) red (d) blue - 22.True or false: p is an id selector. (a) False (b) True
- 23.True or false: HTML rounds box corners. (a) True (b) False
-
24.✍️ How many declarations (property: value pairs) are in this rule?
body {
padding: 8px;
text-align: center;
} - 25.What does justify-content: flex-end do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
- 26.What does font-family do? (a) makes the text bold (b) makes letters bigger (c) picks the font style (d) centres a heading
-
27.✍️ What is the selector in this CSS rule?
h2 {
margin: 10px;
text-align: center;
} (a) center (b) margin (c) h2 (d) h1 - 28.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
-
29.🎯 Which CSS selector matches this element?
<h1 class="note" id="intro">Hello</h1> (a) .big (b) h1 (c) #main (d) #note -
30.🖌️ What colour are the letters?
h2 {
background-color: black;
font-size: 16px;
color: red;
text-align: left;
} (a) black (b) green (c) red -
31.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 1024px) {
p {
font-size: 26px;
}
} (a) No (b) Yes -
32.🎯 Which CSS selector matches this element?
<h2 class="red" id="intro">Hello</h2> (a) .box (b) #main (c) #red (d) .red -
33.🎯 Which CSS selector matches this element?
<h2 class="red" id="intro">Hello</h2> (a) #main (b) #red (c) #intro (d) .intro - 34.True or false: CSS lays out the page. (a) False (b) True
- 35.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
-
36.✍️ What value is given to font-size in this rule?
.note {
font-weight: bold;
padding: 8px;
font-size: 20px;
margin: 10px;
} (a) center (b) font-size (c) 20px (d) yellow - 37.🔍 Which is the odd one out? (a) changes the page live (b) reacts to a button click (c) makes headings and lists (d) checks a quiz answer
-
38.🖌️ What colour is behind the letters?
p {
font-size: 36px;
background-color: black;
text-align: right;
color: orange;
} (a) orange (b) black (c) purple - 39.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <img> (d) <css>
- 40.🌈 Which colour is #00ffff? (a) white (b) red (c) yellow (d) cyan
Answer key
- many pages
- black
- display: flex
- #top
- color
- { }
- purple
- font-family
- background-color
- #0000ff
- JavaScript
- flex-direction
- True
- the gap to other boxes
- <span class="red">
- <li id="top">
- red
- False
- an id selector
- red
- purple
- False
- False
- 2
- packs boxes at the end
- picks the font style
- h2
- CSS
- h1
- red
- No
- .red
- #intro
- True
- padding
- 20px
- makes headings and lists
- black
- <link>
- cyan
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids