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.🖌️ How big is the text, in px?
li {
font-size: 32px;
background-color: red;
color: blue;
text-align: left;
} - 2.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
- 3.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
-
4.⚖️ What colour is the text of this element?
<p class="big" id="top">Hi</p>
CSS:
.big { color: white; }
.big { color: blue; } (a) red (b) white (c) black (d) blue - 5.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
- 6.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) src (d) style
-
7.📱 The screen is 1366px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 600px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 8.What does font-family do? (a) makes the text bold (b) centres a heading (c) makes letters bigger (d) picks the font style
-
9.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 10.Which of these does JavaScript do? (a) checks a quiz answer (b) adds space around boxes (c) makes a form box (d) makes a link
-
11.⚖️ What colour is the text of this element?
<h2 class="menu" id="intro">Hi</h2>
CSS:
h2 { color: white; }
h2 { color: purple; } (a) white (b) yellow (c) red (d) purple - 12.True or false: the content is space outside the border. (a) False (b) True
- 13.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
-
14.📱 The screen is 375px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
15.🖌️ Where does the text sit on its line?
h1 {
text-align: right;
color: red;
background-color: green;
font-size: 24px;
} (a) on the left (b) in the middle (c) on the right -
16.✍️ Which property is set to 20px in this rule?
p {
width: 300px;
font-size: 20px;
font-style: italic;
} (a) 20px (b) background-color (c) font-size (d) text-align - 17.🌈 In #0000cc the blue part is the hex number cc. What is it as a normal number?
-
18.⚖️ What colour is the text of this element?
<h1 class="big" id="main">Hi</h1>
CSS:
#main { color: orange; }
.big { color: purple; }
h1 { color: green; } (a) red (b) orange (c) green (d) purple - 19.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
- 20.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) yellow (c) cyan (d) bright green
- 21.✍️ How does a CSS comment start? (a) <!-- (b) // (c) # (d) /*
-
22.⚖️ What colour is the text of this element?
<p class="box" id="main">Hi</p>
CSS:
p { color: white; }
#main { color: purple; }
.box { color: blue; } (a) white (b) green (c) blue (d) purple -
23.✍️ Which property is set to 20px in this rule?
li {
font-size: 20px;
background-color: yellow;
color: red;
width: 300px;
} (a) text-align (b) 20px (c) font-size (d) background-color -
24.🎯 Which CSS selector matches this element?
<li class="big" id="end">Hello</li> (a) li (b) #hero (c) #big (d) div - 25.🌈 Which colour of light is strongest in rgb(196, 51, 63)? (a) red (b) green (c) blue
- 26.🌈 Which colour of light is strongest in rgb(116, 202, 0)? (a) red (b) green (c) blue
- 27.True or false: .big is an id selector. (a) False (b) True
- 28.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes headings and lists (d) shows a pop-up message
- 29.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
- 30.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
- 31.What does text-align do? (a) makes the text bold (b) sets the letter colour (c) centres a heading (d) picks the font style
- 32.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) display: flex (d) flex-direction
- 33.True or false: #end is an id selector. (a) False (b) True
-
34.✍️ What value is given to background-color in this rule?
h1 {
margin: 10px;
background-color: yellow;
} (a) background-color (b) 10px (c) 8px (d) yellow -
35.✍️ What value is given to color in this rule?
li {
margin: 10px;
background-color: yellow;
text-align: center;
color: red;
} (a) 20px (b) red (c) center (d) color -
36.✍️ How many declarations (property: value pairs) are in this rule?
body {
text-align: center;
color: red;
} - 37.What does color do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) centres a heading
- 38.🌈 Which colour is #ff0000? (a) cyan (b) magenta (c) red (d) white
-
39.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 40px;
padding: 25px;
border: 2px solid black;
margin: 5px;
} -
40.⚖️ What colour is the text of this element?
<h1 class="big" id="hero">Hi</h1>
CSS:
.big { color: green; }
.big { color: red; } (a) red (b) orange (c) green (d) yellow
Answer key
- 32
- packs boxes at the start
- { }
- blue
- an element selector
- style
- No
- picks the font style
- 10
- checks a quiz answer
- purple
- False
- an id selector
- Yes
- on the right
- font-size
- 204
- orange
- the viewport meta tag
- yellow
- /*
- purple
- font-size
- li
- red
- green
- False
- shows a pop-up message
- flex-end
- CSS
- centres a heading
- align-items
- True
- yellow
- red
- 2
- sets the letter colour
- red
- 104
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids