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 colour is #00ffff? (a) black (b) bright green (c) cyan (d) blue
-
2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (max-width: 768px) {
p {
font-size: 20px;
}
} - 3.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Cascading Style Sheets (d) Creative Sheet System
- 4.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) justify-content (d) align-items
- 5.🌈 Which colour is rgb(255, 255, 255)? (a) cyan (b) white (c) black (d) blue
-
6.⚖️ What colour is the text of this element?
<p class="box" id="hero">Hi</p>
CSS:
p { color: orange; }
#hero { color: black; } (a) purple (b) blue (c) black (d) orange - 7.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
- 8.🎯 What kind of selector is img? (a) a class selector (b) an element selector (c) an id selector
-
9.⚖️ What colour is the text of this element?
<h1 class="star" id="intro">Hi</h1>
CSS:
h1 { color: black; }
.star { color: green; }
#intro { color: blue; } (a) white (b) black (c) green (d) blue - 10.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
-
11.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 150px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). -
12.✍️ What value is given to margin in this rule?
.box {
color: red;
margin: 10px;
padding: 8px;
} (a) margin (b) 10px (c) 8px (d) bold - 13.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
- 14.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
- 15.True or false: #hero is an id selector. (a) True (b) False
-
16.✍️ How many declarations (property: value pairs) are in this rule?
h2 {
text-align: center;
font-size: 20px;
font-style: italic;
border: 2px solid;
} - 17.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) content (d) margin
- 18.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
- 19.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a link (c) makes headings and lists (d) makes a form box
- 20.True or false: padding is the line round the box. (a) False (b) True
- 21.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
-
22.⚖️ What colour is the text of this element?
<h1 class="big" id="top">Hi</h1>
CSS:
#top { color: black; }
#top { color: blue; } (a) green (b) purple (c) black (d) blue -
23.🖌️ How big is the text, in px?
h1 {
color: blue;
background-color: green;
text-align: right;
font-size: 12px;
} - 24.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
- 25.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :
-
26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 300px;
padding: 5px;
border: 2px solid black;
margin: 5px;
} - 27.True or false: margin is space inside the border. (a) False (b) True
- 28.True or false: JavaScript makes headings and lists. (a) False (b) True
-
29.⚖️ What colour is the text of this element?
<h2 class="big" id="logo">Hi</h2>
CSS:
h2 { color: red; }
#logo { color: white; } (a) red (b) blue (c) white (d) purple - 30.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
- 31.🎯 Which element does the selector h1 style? (a) <li class="star"> (b) <h2> (c) <div id="top"> (d) <h1 class="star">
-
32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 20px;
}
@media (min-width: 768px) {
p {
font-size: 28px;
}
} - 33.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) magenta (c) black (d) white
-
34.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 130px;
justify-content: flex-start;
}
Inside are 2 boxes, each 50px wide (no margins). - 35.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) centres a heading (d) picks the font style
- 36.Which of these does HTML do? (a) sets colours and fonts (b) changes the text size (c) counts down a timer (d) gives the page structure
- 37.💪 Which flexbox property spaces boxes along a row? (a) gap (b) flex-direction (c) align-items (d) justify-content
-
38.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 24px;
}
@media (min-width: 768px) {
p {
font-size: 26px;
}
} -
39.🖌️ Where does the text sit on its line?
h2 {
font-size: 16px;
background-color: purple;
text-align: right;
color: orange;
} (a) on the left (b) in the middle (c) on the right - 40.📦 In the box model, which part is the gap round content? (a) padding (b) border (c) content (d) margin
Answer key
- cyan
- 24
- Cascading Style Sheets
- display: flex
- white
- black
- align-items
- an element selector
- blue
- many pages
- 50
- 10px
- 255
- HTML
- True
- 4
- border
- fits every screen
- shows a pop-up message
- False
- space-between
- blue
- 12
- an id selector
- blue
- 314
- False
- False
- white
- an element selector
- <h1 class="star">
- 20
- magenta
- 30
- picks the font style
- gives the page structure
- justify-content
- 24
- on the right
- padding
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids