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: CSS adds space around boxes. (a) True (b) False
- 2.📦 In the box model, which part is the text or picture? (a) content (b) border (c) padding (d) margin
- 3.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) red (d) white
-
4.✍️ What value is given to width in this rule?
p {
font-weight: bold;
width: 300px;
border: 2px solid;
} (a) red (b) width (c) 300px (d) italic - 5.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) center (d) flex-end
- 6.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
- 7.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
-
8.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 120px;
padding: 30px;
border: 5px solid black;
margin: 20px;
} - 9.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
- 10.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) center (c) space-between (d) flex-end
-
11.🎯 Which CSS selector matches this element?
<li class="big" id="intro">Hello</li> (a) div (b) #main (c) li (d) #big -
12.🎯 Which CSS selector matches this element?
<h2 class="menu" id="top">Hello</h2> (a) .menu (b) .top (c) #menu (d) #intro - 13.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
-
14.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (max-width: 768px) {
p {
font-size: 10px;
}
} -
15.✍️ What is the selector in this CSS rule?
body {
font-size: 20px;
border: 2px solid;
width: 300px;
text-align: center;
} (a) 2px solid (b) .box (c) font-size (d) body - 16.🎨 Which attribute adds CSS inside one tag? (a) href (b) style (c) alt (d) src
-
17.⚖️ What colour is the text of this element?
<h2 class="note" id="intro">Hi</h2>
CSS:
h2 { color: blue; }
h2 { color: orange; } (a) black (b) yellow (c) blue (d) orange - 18.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
- 19.🌈 Which colour of light is strongest in rgb(12, 82, 240)? (a) red (b) green (c) blue
- 20.Which of these does CSS do? (a) puts a picture on a page (b) makes headings and lists (c) makes a form box (d) adds space around boxes
- 21.What does justify-content: center do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
- 22.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
-
23.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 480px) {
p {
font-size: 30px;
}
} (a) No (b) Yes -
24.📱 The screen is 414px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 18px;
}
} (a) No (b) Yes - 25.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) padding (d) border
-
26.⚖️ What colour is the text of this element?
<h1 class="red" id="hero">Hi</h1>
CSS:
#hero { color: green; }
h1 { color: yellow; } (a) orange (b) yellow (c) green (d) red -
27.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 140px;
padding: 30px;
border: 1px solid black;
margin: 0px;
} -
28.🎯 Which CSS selector matches this element?
<p class="box" id="intro">Hello</p> (a) .intro (b) .box (c) #main (d) .star - 29.🖌️ Which CSS property sets the letter colour? (a) font-family (b) text-align (c) font-size (d) color
- 30.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-weight (c) font-family (d) background-color
-
31.⚖️ What colour is the text of this element?
<h2 class="note" id="end">Hi</h2>
CSS:
#end { color: yellow; }
#end { color: white; } (a) purple (b) white (c) orange (d) yellow -
32.✍️ What value is given to border in this rule?
.box {
border: 2px solid;
font-style: italic;
} (a) 300px (b) border (c) italic (d) 2px solid - 33.🌈 Which hex code is cyan? (a) #00ff00 (b) #000000 (c) #ff00ff (d) #00ffff
-
34.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (min-width: 480px) {
p {
font-size: 22px;
}
} (a) No (b) Yes - 35.🌈 Which hex code is yellow? (a) #0000ff (b) #ffff00 (c) #ff00ff (d) #00ff00
- 36.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
-
37.⚖️ What colour is the text of this element?
<p class="box" id="end">Hi</p>
CSS:
#end { color: white; }
.box { color: yellow; } (a) green (b) white (c) orange (d) yellow - 38.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
- 39.✍️ In color: blue; which part is the property? (a) color (b) blue (c) ; (d) :
-
40.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
text-align: center;
width: 300px;
}
Answer key
- True
- content
- blue
- 300px
- flex-end
- an id selector
- <link>
- 230
- padding
- center
- li
- .menu
- /*
- 16
- body
- style
- orange
- CSS
- blue
- adds space around boxes
- puts boxes in the middle
- :
- No
- No
- padding
- green
- 202
- .box
- color
- font-weight
- white
- 2px solid
- #00ffff
- Yes
- #ffff00
- HTML
- white
- an id selector
- color
- 3
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids