← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 904 · 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.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
  2. 2.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 240px;
      padding: 30px;
      border: 4px solid black;
      margin: 0px;
    }
  3. 3.🌈 Which colour of light is strongest in rgb(25, 57, 188)? (a) blue (b) green (c) red
  4. 4.✍️ What value is given to margin in this rule?
    h1 {
      margin: 10px;
      background-color: yellow;
      font-style: italic;
    }
    (a) bold (b) margin (c) 8px (d) 10px
  5. 5.🖌️ Which CSS property makes the text bold? (a) color (b) font-weight (c) text-align (d) font-family
  6. 6.Which of these is margin? (a) the text or picture (b) space outside the border (c) the gap round content (d) space inside the border
  7. 7.🖌️ How big is the text, in px?
    p {
      background-color: purple;
      text-align: left;
      color: white;
      font-size: 28px;
    }
  8. 8.🖌️ Where does the text sit on its line?
    li {
      background-color: green;
      font-size: 40px;
      text-align: left;
      color: orange;
    }
    (a) on the right (b) on the left (c) in the middle
  9. 9.🌈 Which hex code is white? (a) #ffff00 (b) #000000 (c) #0000ff (d) #ffffff
  10. 10.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-weight (d) font-size
  11. 11.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 20px;
      border: 4px solid black;
      margin: 0px;
    }
  12. 12.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  13. 13.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) text-align (d) font-weight
  14. 14.True or false: HTML checks a quiz answer. (a) False (b) True
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  16. 16.True or false: .card is a class selector. (a) True (b) False
  17. 17.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  18. 18.✍️ What value is given to font-weight in this rule?
    body {
      margin: 10px;
      font-size: 20px;
      font-weight: bold;
    }
    (a) font-weight (b) 2px solid (c) 300px (d) bold
  19. 19.🖌️ What colour are the letters?
    li {
      background-color: white;
      color: yellow;
      text-align: left;
      font-size: 20px;
    }
    (a) white (b) yellow (c) blue
  20. 20.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
  21. 21.True or false: HTML gives the page structure. (a) True (b) False
  22. 22.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-size (d) color
  23. 23.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    p { color: green; }
    (a) blue (b) red (c) green (d) purple
  24. 24.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  25. 25.🌈 Which hex code is blue? (a) #0000ff (b) #ffff00 (c) #ffffff (d) #00ffff
  26. 26.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
  27. 27.🎯 Which element does the selector li style? (a) <p id="hero"> (b) <span class="menu"> (c) <div> (d) <li class="menu">
  28. 28.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) bright green (c) red (d) cyan
  29. 29.🖌️ What colour are the letters?
    h2 {
      color: green;
      text-align: center;
      background-color: purple;
      font-size: 40px;
    }
    (a) yellow (b) purple (c) green
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      width: 300px;
      border: 2px solid;
      font-size: 20px;
      font-weight: bold;
    }
  31. 31.🎯 Which CSS selector matches this element?
    <p class="note" id="main">Hello</p>
    (a) .main (b) #main (c) h1 (d) #logo
  32. 32.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 2 (d) 3
  33. 33.✍️ What value is given to font-size in this rule?
    li {
      font-size: 20px;
      font-style: italic;
      border: 2px solid;
    }
    (a) font-size (b) 20px (c) yellow (d) center
  34. 34.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  36. 36.✍️ What is the selector in this CSS rule?
    li {
      font-style: italic;
      text-align: center;
      border: 2px solid;
      margin: 10px;
    }
    (a) font-style (b) body (c) li (d) center
  37. 37.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  38. 38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  39. 39.🖌️ How big is the text, in px?
    p {
      text-align: left;
      color: white;
      font-size: 36px;
      background-color: blue;
    }
  40. 40.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =

Answer key

  1. red
  2. 308
  3. blue
  4. 10px
  5. font-weight
  6. space outside the border
  7. 28
  8. on the left
  9. #ffffff
  10. font-size
  11. 128
  12. the later one
  13. text-align
  14. False
  15. 60
  16. True
  17. flex-start
  18. bold
  19. yellow
  20. .
  21. True
  22. background-color
  23. green
  24. 20
  25. #0000ff
  26. border
  27. <li class="menu">
  28. red
  29. green
  30. 4
  31. #main
  32. 3
  33. 20px
  34. 800px or wider
  35. 40
  36. li
  37. 50
  38. 16
  39. 36
  40. :

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