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.💪 How much empty space (px) is left after the last box?
.row {
display: flex;
width: 180px;
justify-content: flex-start;
}
Inside are 2 boxes, each 80px wide (no margins). - 2.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-weight (d) font-size
- 3.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
- 4.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) center (c) space-between (d) flex-start
- 5.True or false: #end is an id selector. (a) False (b) True
- 6.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
- 7.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
-
8.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 100px;
padding: 20px;
border: 2px solid black;
margin: 0px;
} -
9.📦 How much space top to bottom (px) does this box take in all, margin included?
.box {
height: 120px;
padding: 20px;
border: 3px solid black;
margin: 0px;
} - 10.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
- 11.True or false: the content is space outside the border. (a) False (b) True
-
12.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 270px;
padding: 5px;
border: 5px solid black;
margin: 0px;
} - 13.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) align-items (d) justify-content
- 14.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 99 (d) 1000
- 15.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
- 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
-
17.⚖️ What colour is the text of this element?
<p class="red" id="logo">Hi</p>
CSS:
p { color: orange; }
p { color: black; } (a) black (b) white (c) blue (d) orange -
18.✍️ How many declarations (property: value pairs) are in this rule?
h1 {
color: red;
text-align: center;
margin: 10px;
font-style: italic;
} -
19.🎯 Which CSS selector matches this element?
<p class="box" id="logo">Hello</p> (a) .box (b) h1 (c) #end (d) .logo -
20.🎯 Which CSS selector matches this element?
<p class="menu" id="top">Hello</p> (a) h1 (b) .note (c) p (d) .top - 21.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
-
22.🎯 Which CSS selector matches this element?
<h2 class="star" id="end">Hello</h2> (a) .menu (b) .end (c) h2 (d) #star - 23.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .css (d) .html
-
24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 120px;
padding: 25px;
border: 5px solid black;
margin: 20px;
} - 25.🌈 Which colour is #ff00ff? (a) cyan (b) blue (c) white (d) magenta
- 26.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
- 27.True or false: JavaScript gives the page structure. (a) True (b) False
- 28.🌈 Which colour is rgb(255, 0, 255)? (a) bright green (b) black (c) red (d) magenta
- 29.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
-
30.✍️ What value is given to font-size in this rule?
.note {
font-size: 20px;
text-align: center;
margin: 10px;
} (a) font-size (b) center (c) yellow (d) 20px - 31.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) blue (c) red (d) cyan
-
32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
p {
font-size: 12px;
}
@media (max-width: 1024px) {
p {
font-size: 10px;
}
} -
33.📱 The screen is 1100px wide. Does the rule inside @media apply?
p {
font-size: 20px;
}
@media (max-width: 1024px) {
p {
font-size: 18px;
}
} (a) Yes (b) No -
34.🖌️ How big is the text, in px?
h1 {
font-size: 16px;
color: white;
background-color: green;
text-align: center;
} - 35.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
-
36.✍️ What value is given to width in this rule?
li {
padding: 8px;
width: 300px;
margin: 10px;
} (a) italic (b) 300px (c) red (d) width -
37.✍️ What value is given to background-color in this rule?
.note {
background-color: yellow;
margin: 10px;
text-align: center;
} (a) yellow (b) 8px (c) background-color (d) 10px - 38.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) space outside the border
- 39.Which of these does CSS do? (a) gives the page structure (b) makes a form box (c) checks a quiz answer (d) sets colours and fonts
- 40.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
Answer key
- 20
- font-size
- color
- flex-end
- True
- HTML
- 1
- 144
- 166
- a class selector
- False
- 290
- display: flex
- 255
- red
- the later one
- black
- 4
- .box
- p
- { }
- h2
- .css
- 180
- magenta
- an element selector
- False
- magenta
- content
- 20px
- cyan
- 10
- No
- 16
- F
- 300px
- yellow
- the text or picture
- sets colours and fonts
- the screen width
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids