← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 244 · 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 sign starts an id selector? (a) . (b) # (c) @ (d) &
  2. 2.🌈 Which colour is #ff00ff? (a) bright green (b) magenta (c) white (d) black
  3. 3.🎯 Which element does the selector #end style? (a) <p id="hero"> (b) <h1 class="star"> (c) <p id="end"> (d) <p class="end">
  4. 4.💪 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 80px wide (no margins).
  5. 5.✍️ What is the selector in this CSS rule?
    .note {
      border: 2px solid;
      font-size: 20px;
      padding: 8px;
    }
    (a) #top (b) .note (c) border (d) 20px
  6. 6.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) space-between (d) flex-end
  7. 7.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-end (d) flex-start
  8. 8.🎯 Which CSS selector matches this element?
    <div class="note" id="logo">Hello</div>
    (a) #note (b) #end (c) div (d) .logo
  9. 9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
  10. 10.🔍 Which is the odd one out? (a) makes a form box (b) counts down a timer (c) makes headings and lists (d) makes a link
  11. 11.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) flex-end (d) space-between
  12. 12.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  13. 13.🖌️ What colour is behind the letters?
    p {
      color: black;
      font-size: 36px;
      text-align: left;
      background-color: green;
    }
    (a) black (b) white (c) green
  14. 14.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) black (c) blue (d) red
  15. 15.🎯 Which element does the selector h1 style? (a) <div id="top"> (b) <h2> (c) <h1 class="star"> (d) <li class="star">
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
  17. 17.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]
  18. 18.📦 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: 2px solid black;
      margin: 0px;
    }
  19. 19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  20. 20.🌈 Which hex code is cyan? (a) #ff0000 (b) #00ffff (c) #00ff00 (d) #ff00ff
  21. 21.🌈 Which colour is rgb(0, 255, 255)? (a) yellow (b) cyan (c) blue (d) magenta
  22. 22.🌈 Which colour is #ffff00? (a) red (b) blue (c) yellow (d) magenta
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    .menu { color: purple; }
    .menu { color: black; }
    (a) purple (b) black (c) white (d) yellow
  24. 24.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  25. 25.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  26. 26.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    .red { color: orange; }
    .red { color: yellow; }
    (a) blue (b) green (c) yellow (d) orange
  27. 27.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  28. 28.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) J (c) Z (d) F
  29. 29.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
  30. 30.🖌️ What colour are the letters?
    li {
      text-align: center;
      background-color: purple;
      color: yellow;
      font-size: 40px;
    }
    (a) purple (b) black (c) yellow
  31. 31.True or false: JavaScript adds space around boxes. (a) False (b) True
  32. 32.✍️ What is the selector in this CSS rule?
    .box {
      font-style: italic;
      color: red;
      padding: 8px;
    }
    (a) .box (b) font-style (c) red (d) h2
  33. 33.🌈 Which colour of light is strongest in rgb(251, 71, 122)? (a) green (b) red (c) blue
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.What does justify-content: flex-start 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
  36. 36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
  37. 37.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
  38. 38.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  39. 39.🌈 Which colour of light is strongest in rgb(30, 207, 53)? (a) green (b) blue (c) red
  40. 40.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) gap (d) align-items

Answer key

  1. #
  2. magenta
  3. <p id="end">
  4. 80
  5. .note
  6. space-between
  7. flex-end
  8. div
  9. 12
  10. counts down a timer
  11. center
  12. 70
  13. green
  14. yellow
  15. <h1 class="star">
  16. the later one
  17. { }
  18. 344
  19. 16
  20. #00ffff
  21. cyan
  22. yellow
  23. black
  24. 10
  25. Yes
  26. yellow
  27. blue
  28. F
  29. .css
  30. yellow
  31. False
  32. .box
  33. red
  34. 80
  35. packs boxes at the start
  36. 12
  37. 800px or wider
  38. 12
  39. green
  40. justify-content

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