← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 635 · 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.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  2. 2.🎯 Which sign starts an id selector? (a) . (b) @ (c) # (d) &
  3. 3.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  4. 4.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  5. 5.✍️ What value is given to background-color in this rule?
    body {
      text-align: center;
      background-color: yellow;
      width: 300px;
    }
    (a) 8px (b) yellow (c) 10px (d) background-color
  6. 6.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) gap (c) display: flex (d) justify-content
  7. 7.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 370px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  8. 8.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  9. 9.🖌️ Which CSS property centres a heading? (a) font-family (b) font-size (c) text-align (d) font-weight
  10. 10.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  11. 11.🖌️ Where does the text sit on its line?
    p {
      font-size: 24px;
      background-color: green;
      color: blue;
      text-align: left;
    }
    (a) on the left (b) on the right (c) in the middle
  12. 12.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) display: flex (c) align-items (d) justify-content
  13. 13.✍️ What is the selector in this CSS rule?
    #top {
      width: 300px;
      color: red;
    }
    (a) li (b) width (c) #top (d) red
  14. 14.🌈 Which colour of light is strongest in rgb(13, 204, 9)? (a) red (b) green (c) blue
  15. 15.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
  16. 16.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  17. 17.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  18. 18.🖌️ Where does the text sit on its line?
    p {
      color: green;
      text-align: left;
      font-size: 28px;
      background-color: red;
    }
    (a) on the right (b) in the middle (c) on the left
  19. 19.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  21. 21.✍️ What value is given to margin in this rule?
    .box {
      margin: 10px;
      font-weight: bold;
    }
    (a) 8px (b) margin (c) bold (d) 10px
  22. 22.✍️ What is the selector in this CSS rule?
    body {
      font-size: 20px;
      text-align: center;
    }
    (a) center (b) body (c) .box (d) font-size
  23. 23.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
    }
  24. 24.True or false: h1 is a class selector. (a) False (b) True
  25. 25.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  26. 26.🖌️ How big is the text, in px?
    p {
      color: blue;
      text-align: left;
      font-size: 28px;
      background-color: green;
    }
  27. 27.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) margin (d) content
  28. 28.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  29. 29.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) space-between (c) flex-end (d) center
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  31. 31.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) font-family (d) color
  32. 32.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  33. 33.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  34. 34.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
  35. 35.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  36. 36.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) black (c) yellow (d) white
  37. 37.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    #logo { color: blue; }
    #logo { color: purple; }
    (a) red (b) blue (c) purple (d) orange
  38. 38.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  39. 39.✍️ What value is given to background-color in this rule?
    h2 {
      margin: 10px;
      background-color: yellow;
    }
    (a) yellow (b) 10px (c) 8px (d) background-color
  40. 40.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2

Answer key

  1. 10
  2. #
  3. HTML
  4. 20
  5. yellow
  6. gap
  7. 70
  8. packs boxes at the start
  9. text-align
  10. puts boxes in the middle
  11. on the left
  12. justify-content
  13. #top
  14. green
  15. 800px or wider
  16. Yes
  17. an element selector
  18. on the left
  19. /*
  20. 60
  21. 10px
  22. body
  23. 1
  24. False
  25. 600px or narrower
  26. 28
  27. margin
  28. the screen width
  29. space-between
  30. 40
  31. background-color
  32. Yes
  33. Yes
  34. .
  35. 16
  36. yellow
  37. purple
  38. No
  39. yellow
  40. 1

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