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 element does the selector div style? (a) <p class="big"> (b) <h1 id="end"> (c) <span> (d) <div class="big">
-
2.✍️ Which property is set to center in this rule?
li {
text-align: center;
font-style: italic;
color: red;
} (a) center (b) margin (c) background-color (d) text-align - 3.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) changes the text size (d) makes a link
- 4.True or false: .menu is a class selector. (a) True (b) False
-
5.✍️ Which property is set to yellow in this rule?
h2 {
text-align: center;
background-color: yellow;
color: red;
} (a) background-color (b) margin (c) yellow (d) padding - 6.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
- 7.Which of these does CSS do? (a) checks a quiz answer (b) sets colours and fonts (c) reacts to a button click (d) makes a link
- 8.What does text-align do? (a) makes letters bigger (b) centres a heading (c) colours behind the text (d) picks the font style
-
9.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 290px;
justify-content: flex-end;
}
Inside are 4 boxes, each 60px wide (no margins). - 10.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
-
11.✍️ What value is given to font-weight in this rule?
body {
border: 2px solid;
font-weight: bold;
text-align: center;
font-size: 20px;
} (a) bold (b) 2px solid (c) 300px (d) font-weight -
12.✍️ Which property is set to italic in this rule?
h1 {
font-style: italic;
color: red;
} (a) italic (b) color (c) font-style (d) font-size - 13.True or false: img is an element selector. (a) True (b) False
-
14.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
text-align: center;
} -
15.✍️ How many declarations (property: value pairs) are in this rule?
p {
background-color: yellow;
} - 16.What does font-size do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
- 17.🔍 Which is the odd one out? (a) lays out the page (b) makes a form box (c) puts a picture on a page (d) makes a link
-
18.⚖️ What colour is the text of this element?
<h1 class="menu" id="top">Hi</h1>
CSS:
h1 { color: green; }
h1 { color: red; } (a) red (b) black (c) green (d) purple - 19.🖌️ Which CSS property makes letters bigger? (a) font-size (b) background-color (c) color (d) font-weight
-
20.🖌️ What colour are the letters?
li {
color: black;
font-size: 24px;
text-align: center;
background-color: green;
} (a) orange (b) black (c) green - 21.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
- 22.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
-
23.⚖️ What colour is the text of this element?
<h1 class="red" id="logo">Hi</h1>
CSS:
h1 { color: black; }
h1 { color: blue; } (a) orange (b) blue (c) yellow (d) black - 24.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
- 25.🎯 Which element does the selector p style? (a) <li id="top"> (b) <h2 class="menu"> (c) <p class="menu"> (d) <h1>
- 26.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
- 27.True or false: CSS puts a picture on a page. (a) True (b) False
- 28.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) padding (d) border
- 29.True or false: CSS adds space around boxes. (a) False (b) True
- 30.True or false: li is an id selector. (a) True (b) False
-
31.✍️ What value is given to margin in this rule?
body {
border: 2px solid;
margin: 10px;
color: red;
background-color: yellow;
} (a) bold (b) 8px (c) 10px (d) margin - 32.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
- 33.🎯 Which element does the selector li style? (a) <p id="hero"> (b) <li class="note"> (c) <div> (d) <span class="note">
-
34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} - 35.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) bright green (c) red (d) black
-
36.⚖️ What colour is the text of this element?
<p class="note" id="main">Hi</p>
CSS:
.note { color: yellow; }
#main { color: orange; } (a) orange (b) blue (c) red (d) yellow -
37.🖌️ What colour are the letters?
li {
background-color: green;
font-size: 32px;
text-align: left;
color: purple;
} (a) green (b) orange (c) purple -
38.⚖️ What colour is the text of this element?
<h2 class="red" id="hero">Hi</h2>
CSS:
#hero { color: red; }
#hero { color: purple; } (a) orange (b) purple (c) blue (d) red - 39.What does font-weight do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
- 40.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
Answer key
- <div class="big">
- text-align
- changes the text size
- True
- background-color
- <link>
- sets colours and fonts
- centres a heading
- 50
- CSS
- bold
- font-style
- True
- 1
- 1
- makes letters bigger
- lays out the page
- red
- font-size
- black
- Cascading Style Sheets
- { }
- blue
- red
- <p class="menu">
- padding
- False
- margin
- True
- False
- 10px
- equal gaps, none at ends
- <li class="note">
- 24
- red
- orange
- purple
- purple
- makes the text bold
- the later one
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids