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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
- 2.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
- 3.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 4.🌈 In #0000dc the blue part is the hex number dc. What is it as a normal number?
-
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 80px;
padding: 10px;
border: 1px solid black;
margin: 5px;
} - 6.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) content (d) border
- 7.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) turned off (d) exactly 100px
-
8.✍️ How many declarations (property: value pairs) are in this rule?
.note {
background-color: yellow;
border: 2px solid;
font-style: italic;
} -
9.🖌️ What colour is behind the letters?
h1 {
color: blue;
text-align: center;
font-size: 40px;
background-color: green;
} (a) yellow (b) blue (c) green - 10.🌈 Which hex code is magenta? (a) #ffffff (b) #00ffff (c) #ff0000 (d) #ff00ff
- 11.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
-
12.⚖️ What colour is the text of this element?
<p class="menu" id="logo">Hi</p>
CSS:
#logo { color: orange; }
p { color: blue; }
.menu { color: white; } (a) black (b) blue (c) white (d) orange -
13.✍️ What is the selector in this CSS rule?
p {
color: red;
padding: 8px;
} (a) .note (b) 8px (c) color (d) p - 14.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
-
15.⚖️ What colour is the text of this element?
<p class="box" id="intro">Hi</p>
CSS:
p { color: black; }
#intro { color: orange; } (a) orange (b) black (c) red (d) purple - 16.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
-
17.🖌️ What colour are the letters?
h1 {
background-color: orange;
color: red;
text-align: left;
font-size: 24px;
} (a) orange (b) yellow (c) red -
18.⚖️ What colour is the text of this element?
<h2 class="big" id="end">Hi</h2>
CSS:
#end { color: orange; }
#end { color: blue; } (a) orange (b) purple (c) red (d) blue - 19.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) border (d) padding
-
20.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} -
21.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 170px;
padding: 30px;
border: 2px solid black;
margin: 5px;
} -
22.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 150px;
justify-content: flex-end;
}
Inside are 2 boxes, each 60px wide (no margins). - 23.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) J (d) Z
- 24.🔍 Which is the odd one out? (a) shows a pop-up message (b) checks a quiz answer (c) changes the page live (d) puts a picture on a page
-
25.✍️ What value is given to padding in this rule?
p {
padding: 8px;
border: 2px solid;
font-style: italic;
} (a) bold (b) padding (c) 2px solid (d) 8px - 26.Which of these does JavaScript do? (a) lays out the page (b) reacts to a button click (c) sets colours and fonts (d) adds space around boxes
- 27.🌈 Which hex code is black? (a) #00ff00 (b) #0000ff (c) #00ffff (d) #000000
- 28.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
-
29.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 600px) {
p {
font-size: 16px;
}
} - 30.Which of these does HTML do? (a) reacts to a button click (b) adds space around boxes (c) makes a link (d) rounds box corners
-
31.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 60px;
padding: 15px;
border: 4px solid black;
margin: 10px;
} - 32.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <li> (c) <h2 class="note"> (d) <div class="note">
- 33.What does justify-content: flex-end do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
-
34.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
#top { color: green; }
#top { color: purple; } (a) orange (b) white (c) purple (d) green - 35.🌈 In #001d00 the green part is the hex number 1d. What is it as a normal number?
-
36.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} -
37.✍️ What value is given to color in this rule?
h1 {
background-color: yellow;
color: red;
padding: 8px;
} (a) color (b) center (c) 20px (d) red - 38.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
-
39.✍️ What is the selector in this CSS rule?
h2 {
margin: 10px;
width: 300px;
font-style: italic;
} (a) margin (b) h1 (c) 300px (d) h2 - 40.🌈 In #610000 the red part is the hex number 61. What is it as a normal number?
Answer key
- the later one
- packs boxes at the start
- an element selector
- 220
- 112
- border
- 800px or wider
- 3
- green
- #ff00ff
- 3
- orange
- p
- Cascading Style Sheets
- orange
- 600px or narrower
- red
- blue
- margin
- 20
- 244
- 30
- F
- puts a picture on a page
- 8px
- reacts to a button click
- #000000
- many pages
- 16
- makes a link
- 118
- <h2 class="note">
- packs boxes at the end
- purple
- 29
- 12
- red
- the screen width
- h2
- 97
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids