← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 999 · 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 is the selector in this CSS rule?
    body {
      padding: 8px;
      margin: 10px;
      background-color: yellow;
      font-size: 20px;
    }
    (a) padding (b) .box (c) body (d) 10px
  2. 2.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  3. 3.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
  4. 4.🎯 Which CSS selector matches this element?
    <div class="menu" id="hero">Hello</div>
    (a) .note (b) div (c) #top (d) .hero
  5. 5.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) display: flex (c) justify-content (d) gap
  6. 6.True or false: padding is the line round the box. (a) True (b) False
  7. 7.🖌️ Which CSS property colours behind the text? (a) font-family (b) font-size (c) color (d) background-color
  8. 8.✍️ What is the selector in this CSS rule?
    p {
      text-align: center;
      font-weight: bold;
    }
    (a) p (b) .note (c) bold (d) text-align
  9. 9.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =
  10. 10.🌈 Which colour of light is strongest in rgb(226, 19, 117)? (a) red (b) green (c) blue
  11. 11.🖌️ How big is the text, in px?
    li {
      text-align: left;
      font-size: 20px;
      background-color: orange;
      color: red;
    }
  12. 12.True or false: CSS makes headings and lists. (a) False (b) True
  13. 13.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <css> (d) <img>
  14. 14.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 3px solid black;
      margin: 5px;
    }
  16. 16.🖌️ What colour is behind the letters?
    h1 {
      text-align: right;
      font-size: 12px;
      background-color: green;
      color: white;
    }
    (a) green (b) white (c) black
  17. 17.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
  18. 18.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      text-align: center;
      width: 300px;
    }
  20. 20.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
      font-weight: bold;
      color: red;
      text-align: center;
    }
  22. 22.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  23. 23.True or false: .note is an id selector. (a) False (b) True
  24. 24.🖌️ What colour are the letters?
    p {
      background-color: black;
      color: yellow;
      text-align: left;
      font-size: 40px;
    }
    (a) yellow (b) black (c) blue
  25. 25.🌈 Which colour of light is strongest in rgb(78, 162, 110)? (a) blue (b) red (c) green
  26. 26.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-weight: bold;
      width: 300px;
    }
  28. 28.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) magenta (c) black (d) bright green
  29. 29.🧩 Which language rounds box corners? (a) HTML (b) CSS (c) JavaScript
  30. 30.🌈 Which colour is rgb(255, 0, 0)? (a) red (b) blue (c) magenta (d) yellow
  31. 31.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="menu"> (c) <span id="end"> (d) <div class="menu">
  32. 32.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  33. 33.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  34. 34.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    #main { color: red; }
    p { color: white; }
    (a) blue (b) green (c) red (d) white
  35. 35.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    .box { color: purple; }
    .box { color: black; }
    (a) black (b) white (c) purple (d) yellow
  37. 37.Which of these does HTML do? (a) checks a quiz answer (b) sets colours and fonts (c) makes a form box (d) adds space around boxes
  38. 38.True or false: #logo is an id selector. (a) True (b) False
  39. 39.True or false: the border is the text or picture. (a) True (b) False
  40. 40.🌈 Which colour is #ff0000? (a) cyan (b) bright green (c) blue (d) red

Answer key

  1. body
  2. 20
  3. F
  4. div
  5. justify-content
  6. False
  7. background-color
  8. p
  9. :
  10. red
  11. 20
  12. False
  13. <link>
  14. space-between
  15. 106
  16. green
  17. 3
  18. 1
  19. 3
  20. 30
  21. 4
  22. 16
  23. False
  24. yellow
  25. green
  26. Yes
  27. 2
  28. bright green
  29. CSS
  30. red
  31. <h2 class="menu">
  32. No
  33. 12
  34. red
  35. red
  36. black
  37. makes a form box
  38. True
  39. False
  40. red

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