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.🖌️ Where does the text sit on its line?
li {
background-color: orange;
font-size: 20px;
text-align: right;
color: red;
} (a) on the right (b) in the middle (c) on the left - 2.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 4px solid black;
margin: 0px;
} - 4.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
- 5.✍️ In color: blue; which part is the value? (a) blue (b) : (c) color (d) ;
-
6.📱 The screen is 320px wide. Does the rule inside @media apply?
p {
font-size: 24px;
}
@media (min-width: 600px) {
p {
font-size: 30px;
}
} (a) No (b) Yes -
7.🎯 Which CSS selector matches this element?
<p class="menu" id="end">Hello</p> (a) .note (b) .menu (c) .end (d) #menu -
8.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (min-width: 1024px) {
p {
font-size: 14px;
}
} - 9.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
- 10.🖌️ Which CSS property picks the font style? (a) font-weight (b) color (c) font-size (d) font-family
- 11.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) bright green (c) yellow (d) magenta
- 12.True or false: #logo is a class selector. (a) True (b) False
-
13.🖌️ Where does the text sit on its line?
h1 {
text-align: right;
color: red;
background-color: purple;
font-size: 32px;
} (a) in the middle (b) on the left (c) on the right -
14.🖌️ What colour are the letters?
h1 {
text-align: right;
font-size: 12px;
background-color: green;
color: yellow;
} (a) green (b) yellow (c) white - 15.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) fits every screen (d) is only for laptops
-
16.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
.star { color: yellow; }
.star { color: orange; } (a) red (b) green (c) orange (d) yellow - 17.🎯 Which element does the selector .box style? (a) <h2 id="box"> (b) <h2 class="box"> (c) <li class="menu"> (d) <h2 class="star">
- 18.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
- 19.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
-
20.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 60px;
padding: 5px;
border: 2px solid black;
margin: 10px;
} - 21.Which of these is padding? (a) space outside the border (b) space inside the border (c) the text or picture (d) the gap to other boxes
- 22.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
- 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 2 (d) 6
- 24.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
- 25.True or false: JavaScript shows a pop-up message. (a) True (b) False
-
26.🖌️ What colour is behind the letters?
h2 {
text-align: left;
font-size: 16px;
background-color: blue;
color: purple;
} (a) blue (b) purple (c) green - 27.What does font-size do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) makes letters bigger
- 28.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
- 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
- 30.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-end (c) space-between (d) flex-start
- 31.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
-
32.🖌️ What colour is behind the letters?
h2 {
text-align: right;
color: yellow;
background-color: orange;
font-size: 40px;
} (a) orange (b) yellow (c) red -
33.📱 The screen is 700px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 600px) {
p {
font-size: 18px;
}
} (a) Yes (b) No - 34.🎯 Which element does the selector .red style? (a) <span class="red"> (b) <span id="red"> (c) <span class="box"> (d) <p class="star">
-
35.🖌️ Where does the text sit on its line?
h2 {
color: white;
text-align: center;
background-color: red;
font-size: 28px;
} (a) on the right (b) on the left (c) in the middle -
36.🖌️ Where does the text sit on its line?
h1 {
background-color: orange;
text-align: right;
font-size: 32px;
color: purple;
} (a) in the middle (b) on the right (c) on the left -
37.⚖️ What colour is the text of this element?
<h1 class="note" id="logo">Hi</h1>
CSS:
.note { color: white; }
.note { color: green; } (a) green (b) white (c) purple (d) black - 38.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) black (d) blue
-
39.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 170px;
justify-content: flex-end;
}
Inside are 3 boxes, each 50px wide (no margins). - 40.🌈 Which colour of light is strongest in rgb(156, 132, 114)? (a) green (b) red (c) blue
Answer key
- on the right
- many pages
- 88
- HTML
- blue
- No
- .menu
- 12
- CSS
- font-family
- cyan
- False
- on the right
- yellow
- fits every screen
- orange
- <h2 class="box">
- an element selector
- 600px or narrower
- 94
- space inside the border
- CSS
- 3
- display: flex
- True
- blue
- makes letters bigger
- .css
- the later one
- flex-end
- /*
- orange
- No
- <span class="red">
- in the middle
- on the right
- green
- red
- 20
- red
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids