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.✍️ What value is given to margin in this rule?
.box {
font-size: 20px;
border: 2px solid;
margin: 10px;
} (a) 8px (b) 10px (c) margin (d) bold -
2.✍️ Which property is set to red in this rule?
.note {
color: red;
background-color: yellow;
} (a) color (b) red (c) font-size (d) text-align - 3.True or false: margin is the gap to other boxes. (a) True (b) False
- 4.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
- 5.Which of these does CSS do? (a) makes headings and lists (b) lays out the page (c) reacts to a button click (d) gives the page structure
- 6.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
-
7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
p {
font-size: 16px;
}
@media (min-width: 768px) {
p {
font-size: 24px;
}
} - 8.True or false: the content is the text or picture. (a) True (b) False
- 9.🎯 Which element does the selector p style? (a) <li id="end"> (b) <h1> (c) <h2 class="big"> (d) <p class="big">
- 10.What does font-size do? (a) colours behind the text (b) makes letters bigger (c) sets the letter colour (d) centres a heading
-
11.🖌️ Where does the text sit on its line?
h1 {
text-align: center;
color: blue;
background-color: red;
font-size: 20px;
} (a) on the left (b) on the right (c) in the middle - 12.🌈 Which colour of light is strongest in rgb(134, 173, 8)? (a) green (b) blue (c) red
- 13.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) flex-direction
-
14.🖌️ What colour are the letters?
li {
text-align: center;
color: blue;
background-color: purple;
font-size: 16px;
} (a) green (b) blue (c) purple - 15.True or false: padding is space inside the border. (a) True (b) False
- 16.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
- 17.What does font-family do? (a) picks the font style (b) centres a heading (c) makes letters bigger (d) colours behind the text
- 18.🖌️ Which CSS property picks the font style? (a) font-weight (b) font-family (c) text-align (d) font-size
-
19.✍️ What value is given to text-align in this rule?
h1 {
padding: 8px;
margin: 10px;
text-align: center;
color: red;
} (a) center (b) 10px (c) text-align (d) yellow - 20.True or false: CSS lays out the page. (a) False (b) True
- 21.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
- 22.True or false: the border is a solid or dotted edge. (a) False (b) True
-
23.📦 How much space across (px) does this box take in all, margin included?
.box {
width: 50px;
padding: 25px;
border: 4px solid black;
margin: 20px;
} - 24.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) color (d) :
-
25.💪 How wide (px) is each gap between two boxes?
.row {
display: flex;
width: 300px;
justify-content: space-between;
}
Inside are 3 boxes, each 60px wide (no margins). - 26.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) center (d) flex-end
- 27.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) border (d) content
- 28.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="intro"> (c) <p class="menu"> (d) <span id="main">
-
29.⚖️ What colour is the text of this element?
<h2 class="menu" id="top">Hi</h2>
CSS:
.menu { color: yellow; }
#top { color: orange; }
h2 { color: purple; } (a) orange (b) yellow (c) purple (d) black - 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 2 (d) 6
- 31.🌈 In #000083 the blue part is the hex number 83. What is it as a normal number?
- 32.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
-
33.📱 The screen is 540px wide. Does the rule inside @media apply?
p {
font-size: 12px;
}
@media (min-width: 768px) {
p {
font-size: 16px;
}
} (a) Yes (b) No -
34.🖌️ How big is the text, in px?
h1 {
background-color: blue;
text-align: center;
font-size: 20px;
color: white;
} - 35.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) green (d) black
-
36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
.box {
width: 240px;
padding: 10px;
border: 3px solid black;
margin: 20px;
} -
37.💪 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). -
38.💪 How much empty space (px) is before the first box?
.row {
display: flex;
width: 200px;
justify-content: flex-end;
}
Inside are 3 boxes, each 40px wide (no margins). -
39.🖌️ What colour are the letters?
h2 {
color: orange;
background-color: black;
font-size: 36px;
text-align: right;
} (a) green (b) black (c) orange - 40.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) centres a heading
Answer key
- 10px
- color
- True
- { }
- lays out the page
- the screen width
- 16
- True
- <p class="big">
- makes letters bigger
- in the middle
- green
- display: flex
- blue
- True
- packs boxes at the start
- picks the font style
- font-family
- center
- True
- <style>
- True
- 148
- blue
- 60
- flex-end
- border
- <span id="intro">
- orange
- 3
- 131
- a class selector
- No
- 20
- red
- 266
- 50
- 80
- orange
- colours behind the text
Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids