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 sign starts a class selector? (a) & (b) . (c) # (d) @
- 2.True or false: margin is the gap to other boxes. (a) False (b) True
- 3.True or false: padding is the gap round content. (a) True (b) False
-
4.🖌️ What colour are the letters?
h1 {
color: blue;
background-color: red;
text-align: left;
font-size: 20px;
} (a) red (b) blue (c) white -
5.✍️ How many declarations (property: value pairs) are in this rule?
li {
font-weight: bold;
font-style: italic;
font-size: 20px;
} -
6.✍️ Which property is set to italic in this rule?
#top {
font-style: italic;
font-weight: bold;
} (a) font-size (b) color (c) font-style (d) italic - 7.🎯 How many elements on a page should have the same id? (a) 2 (b) 1 (c) any number (d) 5
- 8.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <link> (d) <a>
-
9.🖌️ How big is the text, in px?
h1 {
text-align: center;
font-size: 40px;
background-color: red;
color: purple;
} - 10.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) red (c) magenta (d) cyan
- 11.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-size (c) font-weight (d) color
- 12.True or false: margin is the text or picture. (a) True (b) False
- 13.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
- 14.🌈 Which hex code is magenta? (a) #ff0000 (b) #0000ff (c) #ffffff (d) #ff00ff
- 15.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) href (d) alt
- 16.🔍 Which is the odd one out? (a) checks a quiz answer (b) lays out the page (c) rounds box corners (d) adds space around boxes
- 17.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) flex-end (d) center
- 18.True or false: the border is the text or picture. (a) True (b) False
- 19.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
- 20.🌈 Which colour is #00ffff? (a) cyan (b) black (c) blue (d) white
- 21.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) color (d) text-align
-
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 350px;
justify-content: flex-end;
}
Inside are 4 boxes, each 80px wide (no margins). -
23.🖌️ How big is the text, in px?
h2 {
background-color: blue;
font-size: 36px;
text-align: left;
color: black;
} - 24.🌈 Which colour is #0000ff? (a) yellow (b) blue (c) red (d) cyan
-
25.🎯 Which CSS selector matches this element?
<div class="note" id="main">Hello</div> (a) #note (b) span (c) .main (d) #main - 26.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
-
27.⚖️ What colour is the text of this element?
<p class="menu" id="intro">Hi</p>
CSS:
.menu { color: red; }
#intro { color: green; } (a) white (b) black (c) green (d) red - 28.🧩 Which language sets colours and fonts? (a) HTML (b) CSS (c) JavaScript
- 29.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="star"> (c) <span id="top"> (d) <h2 class="star">
- 30.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 70px;
padding: 30px;
border: 2px solid black;
margin: 0px;
} -
32.⚖️ What colour is the text of this element?
<h2 class="box" id="intro">Hi</h2>
CSS:
.box { color: white; }
.box { color: orange; } (a) white (b) green (c) orange (d) red - 33.🌈 Which colour of light is strongest in rgb(227, 26, 62)? (a) blue (b) green (c) red
-
34.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 280px;
padding: 15px;
border: 1px solid black;
margin: 5px;
} -
35.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 210px;
justify-content: flex-start;
}
Inside are 3 boxes, each 60px wide (no margins). - 36.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) gap
-
37.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} (a) No (b) Yes - 38.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) color (d) font-family
-
39.✍️ How many declarations (property: value pairs) are in this rule?
body {
margin: 10px;
text-align: center;
width: 300px;
} - 40.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) black (c) yellow (d) red
Answer key
- .
- True
- True
- blue
- 3
- font-style
- 1
- <link>
- 40
- cyan
- color
- False
- CSS
- #ff00ff
- style
- checks a quiz answer
- flex-end
- False
- 3
- cyan
- font-size
- 30
- 36
- blue
- #main
- 600px or narrower
- green
- CSS
- <h2 class="star">
- a class selector
- 134
- orange
- red
- 322
- 30
- flex-direction
- Yes
- font-family
- 3
- bright green
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids