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: the border is the gap to other boxes. (a) False (b) True
-
2.🖌️ What colour are the letters?
h1 {
background-color: green;
color: black;
font-size: 40px;
text-align: left;
} (a) blue (b) green (c) black -
3.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (max-width: 480px) {
p {
font-size: 10px;
}
} (a) Yes (b) No - 4.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
- 5.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
-
6.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 310px;
justify-content: flex-start;
}
Inside are 4 boxes, each 60px wide (no margins). - 7.🎯 Which sign starts a class selector? (a) @ (b) # (c) & (d) .
- 8.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the page live (c) shows a pop-up message (d) checks a quiz answer
- 9.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
- 10.What does justify-content: flex-start 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
-
11.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 140px;
padding: 15px;
border: 5px solid black;
margin: 5px;
} - 12.🌈 Which hex code is yellow? (a) #00ffff (b) #00ff00 (c) #0000ff (d) #ffff00
- 13.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
- 14.True or false: body is an element selector. (a) True (b) False
- 15.True or false: JavaScript rounds box corners. (a) True (b) False
-
16.🖌️ What colour is behind the letters?
li {
background-color: yellow;
text-align: right;
color: red;
font-size: 24px;
} (a) red (b) yellow (c) purple - 17.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) makes a link (d) gives the page structure
-
18.✍️ What is the selector in this CSS rule?
h1 {
width: 300px;
font-size: 20px;
font-weight: bold;
} (a) h1 (b) width (c) p (d) 20px - 19.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
-
20.🖌️ Where does the text sit on its line?
h1 {
background-color: purple;
color: orange;
text-align: left;
font-size: 20px;
} (a) in the middle (b) on the left (c) on the right - 21.🌈 Which colour of light is strongest in rgb(59, 192, 44)? (a) green (b) blue (c) red
- 22.True or false: .big is a class selector. (a) True (b) False
-
23.🎯 Which CSS selector matches this element?
<li class="big" id="intro">Hello</li> (a) li (b) #main (c) div (d) .intro -
24.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
font-style: italic;
padding: 8px;
width: 300px;
} - 25.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
- 26.🎨 Which attribute adds CSS inside one tag? (a) href (b) src (c) style (d) alt
-
27.✍️ How many declarations (property: value pairs) are in this rule?
li {
color: red;
margin: 10px;
text-align: center;
} - 28.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) magenta (c) blue (d) red
-
29.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
#hero { color: white; }
p { color: orange; }
.box { color: blue; } (a) orange (b) blue (c) white (d) green - 30.True or false: #end is an id selector. (a) True (b) False
-
31.🎯 Which CSS selector matches this element?
<p class="box" id="top">Hello</p> (a) h1 (b) .top (c) #intro (d) p - 32.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
- 33.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
- 34.True or false: #logo is a class selector. (a) True (b) False
- 35.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
- 36.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
- 37.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
-
38.✍️ What value is given to padding in this rule?
p {
padding: 8px;
width: 300px;
background-color: yellow;
font-size: 20px;
} (a) 2px solid (b) bold (c) padding (d) 8px - 39.True or false: padding is space outside the border. (a) False (b) True
- 40.🖌️ Which CSS property picks the font style? (a) background-color (b) font-weight (c) font-family (d) color
Answer key
- False
- black
- Yes
- <style>
- #
- 70
- .
- makes headings and lists
- :
- packs boxes at the start
- 180
- #ffff00
- HTML
- True
- False
- yellow
- changes the page live
- h1
- /*
- on the left
- green
- True
- li
- 3
- { }
- style
- 3
- blue
- white
- True
- p
- the later one
- CSS
- False
- 255
- 600px or narrower
- an element selector
- 8px
- False
- font-family
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids