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 colour is #000000? (a) bright green (b) cyan (c) magenta (d) black
- 2.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
- 3.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
-
4.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 290px;
padding: 20px;
border: 1px solid black;
margin: 0px;
} -
5.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 110px;
padding: 20px;
border: 5px solid black;
margin: 15px;
} - 6.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
- 7.📦 In the box model, which part is space inside the border? (a) padding (b) margin (c) border (d) content
- 8.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
- 9.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) content (d) border
- 10.🎯 Which element does the selector .star style? (a) <h1 class="menu"> (b) <h1 id="star"> (c) <h1 class="star"> (d) <h2 class="note">
-
11.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
margin: 10px;
padding: 8px;
color: red;
border: 2px solid;
} -
12.🖌️ How big is the text, in px?
li {
font-size: 24px;
background-color: purple;
text-align: center;
color: red;
} - 13.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) makes headings and lists (d) shows a pop-up message
-
14.🎯 Which CSS selector matches this element?
<li class="red" id="main">Hello</li> (a) #main (b) div (c) .main (d) #logo - 15.True or false: HTML reacts to a button click. (a) True (b) False
-
16.⚖️ What colour is the text of this element?
<h1 class="box" id="intro">Hi</h1>
CSS:
.box { color: purple; }
#intro { color: red; } (a) black (b) red (c) white (d) purple - 17.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
-
18.🎯 Which CSS selector matches this element?
<p class="red" id="top">Hello</p> (a) h1 (b) .box (c) .top (d) p - 19.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) gives the page structure (d) adds space around boxes
- 20.True or false: padding is the gap round content. (a) False (b) True
- 21.True or false: the border is space outside the border. (a) True (b) False
- 22.🌈 Which hex code is cyan? (a) #0000ff (b) #00ffff (c) #000000 (d) #ff00ff
-
23.🖌️ How big is the text, in px?
p {
background-color: white;
color: green;
text-align: left;
font-size: 20px;
} - 24.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
-
25.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 240px;
justify-content: flex-end;
}
Inside are 4 boxes, each 40px wide (no margins). - 26.🌈 In #0b0000 the red part is the hex number 0b. What is it as a normal number?
-
27.⚖️ What colour is the text of this element?
<p class="note" id="hero">Hi</p>
CSS:
#hero { color: black; }
.note { color: white; }
p { color: red; } (a) black (b) blue (c) white (d) red -
28.⚖️ What colour is the text of this element?
<p class="big" id="intro">Hi</p>
CSS:
#intro { color: blue; }
p { color: white; } (a) blue (b) purple (c) red (d) white -
29.🖌️ How big is the text, in px?
p {
color: white;
font-size: 16px;
text-align: center;
background-color: black;
} - 30.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-size (d) font-family
-
31.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 32.🎯 What kind of selector is #main? (a) an id selector (b) an element selector (c) a class selector
-
33.⚖️ What colour is the text of this element?
<h1 class="note" id="end">Hi</h1>
CSS:
h1 { color: yellow; }
h1 { color: blue; } (a) green (b) black (c) blue (d) yellow - 34.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <a> (d) <img>
- 35.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
-
36.🎯 Which CSS selector matches this element?
<h2 class="box" id="top">Hello</h2> (a) h2 (b) .top (c) #box (d) #intro -
37.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 768px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
38.✍️ What value is given to font-style in this rule?
body {
font-style: italic;
font-size: 20px;
width: 300px;
text-align: center;
} (a) italic (b) 20px (c) font-style (d) red - 39.True or false: CSS sets colours and fonts. (a) False (b) True
-
40.📱 The screen is 820px wide. Does the rule inside @media apply?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} (a) No (b) Yes
Answer key
- black
- 600px or narrower
- .
- 332
- 190
- content
- padding
- an id selector
- padding
- <h1 class="star">
- 4
- 24
- shows a pop-up message
- #main
- False
- red
- ;
- p
- adds space around boxes
- True
- False
- #00ffff
- 20
- flex-start
- 80
- 11
- black
- blue
- 16
- color
- No
- an id selector
- blue
- <link>
- the text or picture
- h2
- Yes
- italic
- True
- Yes
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids