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 CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-size
- 2.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="note"> (c) <span id="top"> (d) <div class="note">
- 3.🧩 Which language rounds box corners? (a) HTML (b) JavaScript (c) CSS
- 4.True or false: #end is an element selector. (a) True (b) False
-
5.⚖️ What colour is the text of this element?
<p class="big" id="logo">Hi</p>
CSS:
p { color: yellow; }
p { color: white; } (a) yellow (b) blue (c) black (d) white - 6.🌈 In #008200 the green part is the hex number 82. What is it as a normal number?
- 7.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
-
8.⚖️ What colour is the text of this element?
<h2 class="big" id="top">Hi</h2>
CSS:
.big { color: yellow; }
.big { color: white; } (a) yellow (b) green (c) purple (d) white - 9.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) flex-end (d) space-between
-
10.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 160px;
justify-content: flex-end;
}
Inside are 2 boxes, each 40px wide (no margins). - 11.🔍 Which is the odd one out? (a) makes a link (b) gives the page structure (c) makes a form box (d) sets colours and fonts
- 12.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
-
13.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
14.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 480px;
justify-content: center;
}
Inside are 4 boxes, each 100px wide (no margins). - 15.True or false: HTML makes a form box. (a) True (b) False
-
16.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 17.True or false: HTML makes a link. (a) True (b) False
- 18.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) padding (d) content
-
19.⚖️ What colour is the text of this element?
<p class="big" id="hero">Hi</p>
CSS:
.big { color: white; }
p { color: orange; } (a) blue (b) orange (c) white (d) black -
20.✍️ Which property is set to red in this rule?
body {
color: red;
font-size: 20px;
padding: 8px;
font-weight: bold;
} (a) font-size (b) text-align (c) red (d) color - 21.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 3 (c) 4 (d) 2
- 22.🌈 Which colour is #ff0000? (a) cyan (b) red (c) yellow (d) white
- 23.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
- 24.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) flex-direction (c) justify-content (d) display: flex
- 25.📱 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
- 26.🖌️ Which CSS property picks the font style? (a) color (b) font-weight (c) text-align (d) font-family
- 27.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) only one word (d) many pages
- 28.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
- 29.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-family (c) font-size (d) font-weight
- 30.🎯 Which element does the selector #main style? (a) <li id="logo"> (b) <li class="main"> (c) <div class="note"> (d) <li id="main">
- 31.🎯 What kind of selector is #end? (a) an id selector (b) a class selector (c) an element selector
-
32.⚖️ What colour is the text of this element?
<h1 class="big" id="intro">Hi</h1>
CSS:
h1 { color: blue; }
h1 { color: red; } (a) blue (b) red (c) orange (d) purple - 33.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the first one (d) the later one
-
34.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 1024px) {
p {
font-size: 24px;
}
} -
35.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
#main { color: purple; }
#main { color: black; } (a) green (b) yellow (c) black (d) purple - 36.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
- 37.True or false: CSS sets colours and fonts. (a) False (b) True
- 38.True or false: margin is the gap to other boxes. (a) True (b) False
-
39.✍️ Which property is set to 2px solid in this rule?
.box {
border: 2px solid;
font-weight: bold;
} (a) 2px solid (b) border (c) width (d) font-style - 40.True or false: CSS counts down a timer. (a) True (b) False
Answer key
- background-color
- <h2 class="note">
- CSS
- False
- white
- 130
- padding
- white
- flex-start
- 80
- sets colours and fonts
- an id selector
- No
- 40
- True
- Yes
- True
- margin
- white
- color
- 3
- red
- { }
- justify-content
- the viewport meta tag
- font-family
- many pages
- <link>
- font-weight
- <li id="main">
- an id selector
- red
- the later one
- 16
- black
- red
- True
- True
- border
- False
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids