← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 706 · 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 is the odd one out? (a) adds space around boxes (b) counts down a timer (c) shows a pop-up message (d) changes the page live
  2. 2.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) neither (d) the first one
  3. 3.True or false: the content is a solid or dotted edge. (a) False (b) True
  4. 4.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  5. 5.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) margin (d) border
  6. 6.🖌️ What colour are the letters?
    h1 {
      color: orange;
      text-align: left;
      font-size: 20px;
      background-color: green;
    }
    (a) blue (b) green (c) orange
  7. 7.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    p { color: purple; }
    #top { color: red; }
    (a) white (b) purple (c) red (d) green
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  9. 9.✍️ What value is given to text-align in this rule?
    .note {
      font-size: 20px;
      text-align: center;
      background-color: yellow;
    }
    (a) text-align (b) yellow (c) 10px (d) center
  10. 10.🎯 Which element does the selector .note style? (a) <h2 class="red"> (b) <h1 class="note"> (c) <h1 class="big"> (d) <h1 id="note">
  11. 11.True or false: HTML checks a quiz answer. (a) True (b) False
  12. 12.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) exactly 1000px (d) turned off
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  14. 14.🎯 Which CSS selector matches this element?
    <div class="menu" id="hero">Hello</div>
    (a) div (b) span (c) .hero (d) #top
  15. 15.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) padding (d) border
  16. 16.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  17. 17.✍️ Which property is set to yellow in this rule?
    h1 {
      font-weight: bold;
      background-color: yellow;
      color: red;
      width: 300px;
    }
    (a) margin (b) background-color (c) yellow (d) padding
  18. 18.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  20. 20.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
  21. 21.💪 Which flexbox property sets space between boxes? (a) justify-content (b) gap (c) display: flex (d) align-items
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      padding: 8px;
    }
  23. 23.🖌️ What colour are the letters?
    h2 {
      text-align: left;
      font-size: 28px;
      background-color: red;
      color: white;
    }
    (a) orange (b) red (c) white
  24. 24.Which of these is the border? (a) space inside the border (b) the gap round content (c) space outside the border (d) a solid or dotted edge
  25. 25.Which of these does HTML do? (a) counts down a timer (b) sets colours and fonts (c) shows a pop-up message (d) makes headings and lists
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 10px;
      border: 2px solid black;
      margin: 5px;
    }
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  28. 28.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    p { color: red; }
    .box { color: white; }
    #top { color: green; }
    (a) red (b) green (c) purple (d) white
  29. 29.True or false: padding is space inside the border. (a) True (b) False
  30. 30.Which of these does JavaScript do? (a) counts down a timer (b) rounds box corners (c) puts a picture on a page (d) makes a form box
  31. 31.True or false: JavaScript changes the text size. (a) False (b) True
  32. 32.🖌️ What colour is behind the letters?
    h2 {
      text-align: left;
      color: red;
      font-size: 32px;
      background-color: green;
    }
    (a) orange (b) red (c) green
  33. 33.True or false: .star is an element selector. (a) True (b) False
  34. 34.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-family (d) font-size
  35. 35.🔍 Which is the odd one out? (a) counts down a timer (b) changes the page live (c) lays out the page (d) shows a pop-up message
  36. 36.True or false: .card is a class selector. (a) False (b) True
  37. 37.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    .star { color: black; }
    #logo { color: white; }
    (a) white (b) black (c) orange (d) green
  38. 38.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) center (d) flex-end
  39. 39.🌈 Which colour is #ff0000? (a) blue (b) yellow (c) red (d) bright green
  40. 40.✍️ What value is given to background-color in this rule?
    #top {
      text-align: center;
      background-color: yellow;
    }
    (a) 8px (b) background-color (c) yellow (d) 10px

Answer key

  1. adds space around boxes
  2. the later one
  3. False
  4. Yes
  5. padding
  6. orange
  7. red
  8. 80
  9. center
  10. <h1 class="note">
  11. False
  12. 600px or narrower
  13. 50
  14. div
  15. border
  16. an id selector
  17. background-color
  18. packs boxes at the start
  19. 20
  20. red
  21. gap
  22. 2
  23. white
  24. a solid or dotted edge
  25. makes headings and lists
  26. 144
  27. 204
  28. green
  29. True
  30. counts down a timer
  31. False
  32. green
  33. False
  34. background-color
  35. lays out the page
  36. True
  37. white
  38. flex-end
  39. red
  40. yellow

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