← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 223 · 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.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  2. 2.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) blue (c) white (d) green
  3. 3.🌈 Which colour is #ffffff? (a) black (b) yellow (c) red (d) white
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 460px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  5. 5.Which of these does JavaScript do? (a) lays out the page (b) shows a pop-up message (c) sets colours and fonts (d) makes a link
  6. 6.🎯 Which CSS selector matches this element?
    <h1 class="note" id="main">Hello</h1>
    (a) .big (b) h2 (c) .main (d) h1
  7. 7.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  8. 8.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 32px;
      text-align: left;
      color: purple;
      background-color: blue;
    }
    (a) in the middle (b) on the left (c) on the right
  9. 9.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  10. 10.What does font-size do? (a) centres a heading (b) sets the letter colour (c) makes the text bold (d) makes letters bigger
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  12. 12.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
  13. 13.True or false: the content is the text or picture. (a) False (b) True
  14. 14.True or false: CSS rounds box corners. (a) False (b) True
  15. 15.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  16. 16.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-family (c) font-size (d) color
  17. 17.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  18. 18.True or false: #logo is an element selector. (a) True (b) False
  19. 19.🖌️ What colour is behind the letters?
    p {
      color: red;
      background-color: blue;
      text-align: center;
      font-size: 40px;
    }
    (a) blue (b) white (c) red
  20. 20.🌈 Which hex code is bright green? (a) #00ffff (b) #ffff00 (c) #00ff00 (d) #ff00ff
  21. 21.✍️ What value is given to font-weight in this rule?
    li {
      text-align: center;
      font-weight: bold;
    }
    (a) font-weight (b) 2px solid (c) bold (d) 300px
  22. 22.Which of these does JavaScript do? (a) puts a picture on a page (b) reacts to a button click (c) makes a form box (d) makes a link
  23. 23.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  24. 24.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) flex-end (c) center (d) space-between
  25. 25.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
  26. 26.Which of these does CSS do? (a) rounds box corners (b) changes the page live (c) shows a pop-up message (d) makes a form box
  27. 27.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  28. 28.🎯 Which CSS selector matches this element?
    <span class="note" id="hero">Hello</span>
    (a) span (b) p (c) #note (d) #top
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  30. 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 6 (c) 2 (d) 4
  31. 31.True or false: .card is an id selector. (a) False (b) True
  32. 32.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  33. 33.🌈 Which colour is rgb(255, 0, 0)? (a) white (b) yellow (c) red (d) blue
  34. 34.True or false: CSS checks a quiz answer. (a) True (b) False
  35. 35.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
  36. 36.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  37. 37.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    .big { color: yellow; }
    p { color: green; }
    (a) green (b) yellow (c) red (d) white
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      margin: 10px;
      color: red;
    }
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
      font-weight: bold;
      padding: 8px;
    }
  40. 40.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,

Answer key

  1. equal gaps, none at ends
  2. blue
  3. white
  4. 30
  5. shows a pop-up message
  6. h1
  7. an element selector
  8. on the left
  9. No
  10. makes letters bigger
  11. 254
  12. <style>
  13. True
  14. True
  15. color
  16. color
  17. the screen width
  18. False
  19. blue
  20. #00ff00
  21. bold
  22. reacts to a button click
  23. 10
  24. flex-end
  25. display: flex
  26. rounds box corners
  27. 10
  28. span
  29. 342
  30. 3
  31. False
  32. CSS
  33. red
  34. False
  35. :
  36. 60
  37. yellow
  38. 3
  39. 3
  40. ;

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