← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 995 · 40 questions
TalentJR

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. 1.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  2. 2.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 530px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  3. 3.🌈 Which colour is #000000? (a) white (b) magenta (c) blue (d) black
  4. 4.🌈 In #0000bc the blue part is the hex number bc. What is it as a normal number?
  5. 5.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-size (c) font-weight (d) font-family
  6. 6.True or false: the border is the line round the box. (a) False (b) True
  7. 7.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) only one image (d) many pages
  8. 8.🎯 Which element does the selector #main style? (a) <span class="red"> (b) <div id="logo"> (c) <div id="main"> (d) <div class="main">
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      background-color: yellow;
      font-style: italic;
    }
  10. 10.Which of these is the border? (a) the gap round content (b) space outside the border (c) the text or picture (d) the line round the box
  11. 11.🎨 A CSS file usually ends with which extension? (a) .html (b) .png (c) .css (d) .js
  12. 12.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
  13. 13.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-size (c) color (d) background-color
  14. 14.Which of these is the border? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the gap round content
  15. 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
  16. 16.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  18. 18.🌈 Which colour is #ffff00? (a) blue (b) magenta (c) bright green (d) yellow
  19. 19.💪 Which flexbox property lines boxes up across? (a) gap (b) flex-direction (c) justify-content (d) align-items
  20. 20.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
  21. 21.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    .note { color: blue; }
    .note { color: green; }
    (a) purple (b) green (c) blue (d) black
  22. 22.Which of these does CSS do? (a) puts a picture on a page (b) counts down a timer (c) rounds box corners (d) gives the page structure
  23. 23.What does font-family do? (a) makes the text bold (b) colours behind the text (c) centres a heading (d) picks the font style
  24. 24.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  25. 25.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
  26. 26.✍️ What is the selector in this CSS rule?
    .note {
      font-size: 20px;
      padding: 8px;
    }
    (a) .note (b) 8px (c) font-size (d) #top
  27. 27.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-end (c) center (d) flex-start
  28. 28.🖌️ What colour are the letters?
    p {
      background-color: red;
      text-align: center;
      color: orange;
      font-size: 20px;
    }
    (a) blue (b) red (c) orange
  29. 29.Which of these does CSS do? (a) reacts to a button click (b) sets colours and fonts (c) gives the page structure (d) checks a quiz answer
  30. 30.🖌️ What colour is behind the letters?
    h2 {
      text-align: right;
      font-size: 16px;
      background-color: red;
      color: blue;
    }
    (a) blue (b) white (c) red
  31. 31.True or false: padding is the gap round content. (a) True (b) False
  32. 32.True or false: HTML makes a form box. (a) False (b) True
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  34. 34.✍️ Which property is set to 300px in this rule?
    #top {
      width: 300px;
      background-color: yellow;
    }
    (a) width (b) font-style (c) color (d) 300px
  35. 35.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    #end { color: purple; }
    h2 { color: white; }
    .big { color: green; }
    (a) green (b) red (c) purple (d) white
  37. 37.🎯 Which element does the selector #intro style? (a) <h2 id="intro"> (b) <h2 id="main"> (c) <li class="menu"> (d) <h2 class="intro">
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-size: 20px;
      width: 300px;
      background-color: yellow;
      margin: 10px;
    }
  39. 39.True or false: img is an element selector. (a) False (b) True
  40. 40.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 6 (d) 2

Answer key

  1. :
  2. 70
  3. black
  4. 188
  5. font-weight
  6. True
  7. many pages
  8. <div id="main">
  9. 3
  10. the line round the box
  11. .css
  12. the screen width
  13. background-color
  14. a solid or dotted edge
  15. 800px or wider
  16. an id selector
  17. 40
  18. yellow
  19. align-items
  20. fits every screen
  21. green
  22. rounds box corners
  23. picks the font style
  24. packs boxes at the end
  25. blue
  26. .note
  27. center
  28. orange
  29. sets colours and fonts
  30. red
  31. True
  32. True
  33. 20
  34. width
  35. #
  36. purple
  37. <h2 id="intro">
  38. 4
  39. True
  40. 3

Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids