← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 979 · 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 much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  2. 2.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    #logo { color: green; }
    #logo { color: red; }
    (a) yellow (b) purple (c) green (d) red
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  5. 5.✍️ Which property is set to red in this rule?
    p {
      font-size: 20px;
      text-align: center;
      color: red;
    }
    (a) font-size (b) color (c) text-align (d) red
  6. 6.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) flex-end (c) space-between (d) center
  7. 7.True or false: HTML rounds box corners. (a) False (b) True
  8. 8.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  9. 9.✍️ What is the selector in this CSS rule?
    h2 {
      font-weight: bold;
      font-size: 20px;
    }
    (a) font-weight (b) h2 (c) h1 (d) 20px
  10. 10.True or false: the content is space outside the border. (a) True (b) False
  11. 11.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) center (d) space-between
  12. 12.Which of these does JavaScript do? (a) changes the text size (b) rounds box corners (c) reacts to a button click (d) makes a link
  13. 13.🎯 Can many elements share the same class? (a) Yes (b) No
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    h2 { color: blue; }
    #end { color: purple; }
    (a) black (b) blue (c) purple (d) yellow
  15. 15.✍️ What value is given to font-size in this rule?
    h1 {
      text-align: center;
      width: 300px;
      padding: 8px;
      font-size: 20px;
    }
    (a) center (b) font-size (c) 20px (d) yellow
  16. 16.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
  17. 17.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) green (d) black
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 440px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  19. 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
  20. 20.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
  21. 21.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  22. 22.🎯 What kind of selector is #top? (a) an element selector (b) an id selector (c) a class selector
  23. 23.🎯 What kind of selector is #end? (a) an id selector (b) a class selector (c) an element selector
  24. 24.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  25. 25.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      font-size: 28px;
      color: green;
      background-color: purple;
    }
    (a) green (b) purple (c) blue
  26. 26.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
  27. 27.✍️ What value is given to background-color in this rule?
    h1 {
      background-color: yellow;
      border: 2px solid;
    }
    (a) background-color (b) 10px (c) 8px (d) yellow
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
    }
  29. 29.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 100px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  31. 31.What does background-color do? (a) makes letters bigger (b) centres a heading (c) colours behind the text (d) sets the letter colour
  32. 32.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) color (d) background-color
  33. 33.🖌️ Where does the text sit on its line?
    p {
      background-color: yellow;
      font-size: 28px;
      color: red;
      text-align: left;
    }
    (a) on the left (b) on the right (c) in the middle
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  36. 36.✍️ Which sign goes between a property and its value? (a) = (b) - (c) ; (d) :
  37. 37.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
  38. 38.True or false: CSS changes the page live. (a) False (b) True
  39. 39.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  40. 40.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      font-style: italic;
      margin: 10px;
    }
    (a) h2 (b) border (c) italic (d) h1

Answer key

  1. 40
  2. HTML
  3. red
  4. 60
  5. color
  6. flex-end
  7. False
  8. /*
  9. h2
  10. False
  11. flex-start
  12. reacts to a button click
  13. Yes
  14. purple
  15. 20px
  16. puts boxes in the middle
  17. red
  18. 20
  19. the later one
  20. an element selector
  21. an element selector
  22. an id selector
  23. an id selector
  24. <style>
  25. green
  26. 24
  27. yellow
  28. 1
  29. content
  30. 20
  31. colours behind the text
  32. background-color
  33. on the left
  34. 60
  35. 20
  36. :
  37. an id selector
  38. False
  39. 22
  40. h2

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