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 flexbox property lines boxes up across? (a) display: flex (b) gap (c) flex-direction (d) align-items
- 2.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
-
3.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 70px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} - 4.🌈 Which colour of light is strongest in rgb(203, 94, 13)? (a) red (b) blue (c) green
- 5.🖌️ Which CSS property centres a heading? (a) font-size (b) text-align (c) font-weight (d) font-family
-
6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 210px;
padding: 30px;
border: 1px solid black;
margin: 10px;
} - 7.True or false: the border is a solid or dotted edge. (a) False (b) True
- 8.Which of these does HTML do? (a) changes the text size (b) counts down a timer (c) adds space around boxes (d) gives the page structure
- 9.🎯 Which sign starts an id selector? (a) # (b) . (c) @ (d) &
- 10.🔍 Which is the odd one out? (a) checks a quiz answer (b) adds space around boxes (c) reacts to a button click (d) counts down a timer
- 11.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) picks the font style
- 12.🌈 Which colour of light is strongest in rgb(150, 20, 7)? (a) blue (b) red (c) green
- 13.🔍 Which is the odd one out? (a) puts a picture on a page (b) lays out the page (c) sets colours and fonts (d) adds space around boxes
-
14.🖌️ What colour are the letters?
h1 {
text-align: right;
background-color: orange;
font-size: 32px;
color: white;
} (a) white (b) green (c) orange - 15.True or false: margin is space inside the border. (a) True (b) False
- 16.⚖️ 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
-
17.🖌️ Where does the text sit on its line?
li {
background-color: orange;
font-size: 40px;
color: black;
text-align: center;
} (a) on the right (b) on the left (c) in the middle -
18.🖌️ What colour is behind the letters?
h2 {
background-color: red;
text-align: right;
font-size: 20px;
color: blue;
} (a) blue (b) black (c) red -
19.🖌️ How big is the text, in px?
h1 {
background-color: red;
text-align: left;
color: yellow;
font-size: 32px;
} - 20.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
-
21.🎯 Which CSS selector matches this element?
<p class="star" id="logo">Hello</p> (a) .menu (b) #star (c) #logo (d) h1 -
22.✍️ What is the selector in this CSS rule?
h2 {
background-color: yellow;
text-align: center;
font-weight: bold;
} (a) h1 (b) h2 (c) background-color (d) center -
23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 90px;
padding: 10px;
border: 2px solid black;
margin: 10px;
} -
24.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 600px) {
p {
font-size: 8px;
}
} - 25.🌈 Which colour of light is strongest in rgb(232, 18, 87)? (a) green (b) blue (c) red
- 26.🌈 In #790000 the red part is the hex number 79. What is it as a normal number?
-
27.⚖️ What colour is the text of this element?
<h1 class="red" id="top">Hi</h1>
CSS:
h1 { color: blue; }
#top { color: orange; } (a) blue (b) orange (c) yellow (d) black - 28.🎯 Can many elements share the same class? (a) No (b) Yes
-
29.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 110px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 30.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
- 31.💪 Which flexbox property picks row or column? (a) flex-direction (b) display: flex (c) justify-content (d) gap
- 32.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
-
33.🖌️ How big is the text, in px?
li {
background-color: red;
font-size: 16px;
color: blue;
text-align: left;
} - 34.🌈 Which colour of light is strongest in rgb(24, 140, 200)? (a) blue (b) green (c) red
-
35.✍️ What value is given to font-weight in this rule?
.box {
font-weight: bold;
background-color: yellow;
} (a) bold (b) 2px solid (c) font-weight (d) 300px - 36.🎯 Which element does the selector #top style? (a) <h1 class="star"> (b) <p class="top"> (c) <p id="top"> (d) <p id="intro">
- 37.🌈 In #00007d the blue part is the hex number 7d. What is it as a normal number?
- 38.🎯 What kind of selector is .big? (a) an element selector (b) an id selector (c) a class selector
- 39.Which of these is padding? (a) the text or picture (b) the gap to other boxes (c) the gap round content (d) the line round the box
-
40.✍️ Which property is set to yellow in this rule?
h1 {
background-color: yellow;
text-align: center;
padding: 8px;
} (a) padding (b) yellow (c) margin (d) background-color
Answer key
- align-items
- HTML
- 90
- red
- text-align
- 272
- True
- gives the page structure
- #
- adds space around boxes
- colours behind the text
- red
- puts a picture on a page
- white
- False
- the later one
- in the middle
- red
- 32
- Cascading Style Sheets
- #logo
- h2
- 114
- 12
- red
- 121
- orange
- Yes
- 10
- the screen width
- flex-direction
- 3
- 16
- blue
- bold
- <p id="top">
- 125
- a class selector
- the gap round content
- background-color
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids