← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 566 · 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.True or false: body is an id selector. (a) True (b) False
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    #hero { color: green; }
    h1 { color: yellow; }
    .note { color: white; }
    (a) yellow (b) white (c) green (d) red
  3. 3.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-end (c) flex-start (d) space-between
  4. 4.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) white (c) red (d) cyan
  5. 5.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  6. 6.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) puts a picture on a page (d) shows a pop-up message
  7. 7.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  8. 8.🌈 Which colour is #ffff00? (a) bright green (b) yellow (c) black (d) blue
  9. 9.🌈 Which colour is #0000ff? (a) red (b) yellow (c) white (d) blue
  10. 10.True or false: HTML puts a picture on a page. (a) True (b) False
  11. 11.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    .red { color: orange; }
    .red { color: white; }
    (a) purple (b) orange (c) white (d) green
  12. 12.✍️ Which property is set to center in this rule?
    h1 {
      text-align: center;
      font-style: italic;
    }
    (a) center (b) margin (c) text-align (d) background-color
  13. 13.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      background-color: yellow;
      font-size: 12px;
      color: white;
    }
    (a) white (b) yellow (c) green
  14. 14.🌈 Which hex code is magenta? (a) #00ffff (b) #00ff00 (c) #ffff00 (d) #ff00ff
  15. 15.🖌️ Which CSS property colours behind the text? (a) font-weight (b) background-color (c) font-size (d) text-align
  16. 16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  17. 17.🎯 What kind of selector is h1? (a) an element selector (b) an id selector (c) a class selector
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 5px;
      border: 3px solid black;
      margin: 5px;
    }
  19. 19.📦 In the box model, which part is space inside the border? (a) margin (b) padding (c) border (d) content
  20. 20.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .js (d) .png
  21. 21.🌈 In #0000c2 the blue part is the hex number c2. What is it as a normal number?
  22. 22.True or false: img is an id selector. (a) False (b) True
  23. 23.🌈 In #00006f the blue part is the hex number 6f. What is it as a normal number?
  24. 24.🖌️ Which CSS property makes the text bold? (a) font-size (b) text-align (c) color (d) font-weight
  25. 25.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the hr tag (c) the viewport meta tag (d) the br tag
  26. 26.🖌️ What colour is behind the letters?
    li {
      color: red;
      background-color: black;
      font-size: 20px;
      text-align: center;
    }
    (a) red (b) black (c) green
  27. 27.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) display: flex (d) gap
  28. 28.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 5px;
      border: 1px solid black;
      margin: 10px;
    }
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  31. 31.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  32. 32.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  33. 33.What does font-size do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
  34. 34.🌈 Which colour of light is strongest in rgb(236, 66, 7)? (a) red (b) green (c) blue
  35. 35.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
  36. 36.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) magenta (c) blue (d) white
  37. 37.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  39. 39.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  40. 40.🖌️ Which CSS property centres a heading? (a) font-family (b) text-align (c) background-color (d) color

Answer key

  1. False
  2. green
  3. space-between
  4. red
  5. 12
  6. puts a picture on a page
  7. HTML
  8. yellow
  9. blue
  10. True
  11. white
  12. text-align
  13. white
  14. #ff00ff
  15. background-color
  16. 16
  17. an element selector
  18. 306
  19. padding
  20. .css
  21. 194
  22. False
  23. 111
  24. font-weight
  25. the viewport meta tag
  26. black
  27. flex-direction
  28. 3
  29. 112
  30. 30
  31. :
  32. Yes
  33. makes letters bigger
  34. red
  35. ;
  36. yellow
  37. Yes
  38. 60
  39. red
  40. text-align

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