← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 444 · 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 #00bf00 the green part is the hex number bf. What is it as a normal number?
  2. 2.🌈 Which colour of light is strongest in rgb(11, 0, 180)? (a) red (b) blue (c) green
  3. 3.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the line round the box (d) space inside the border
  4. 4.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  5. 5.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
  6. 6.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  7. 7.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  8. 8.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
  9. 9.🎯 Which element does the selector .note style? (a) <h1 id="note"> (b) <h1 class="note"> (c) <h1 class="big"> (d) <h2 class="red">
  10. 10.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
  11. 11.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  12. 12.🌈 In #00005b the blue part is the hex number 5b. What is it as a normal number?
  13. 13.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) gap (c) display: flex (d) justify-content
  14. 14.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) blue (c) yellow (d) magenta
  15. 15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  16. 16.⚖️ 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
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  18. 18.🖌️ Which CSS property makes the text bold? (a) font-size (b) font-family (c) font-weight (d) background-color
  19. 19.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  20. 20.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <body> (d) <script>
  21. 21.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  22. 22.🎯 Which sign starts an id selector? (a) & (b) . (c) # (d) @
  23. 23.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
  24. 24.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) content (d) padding
  25. 25.✍️ Which property is set to center in this rule?
    h1 {
      width: 300px;
      text-align: center;
    }
    (a) background-color (b) margin (c) center (d) text-align
  26. 26.🖌️ How big is the text, in px?
    h1 {
      text-align: left;
      color: yellow;
      font-size: 24px;
      background-color: green;
    }
  27. 27.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  28. 28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  29. 29.✍️ What value is given to text-align in this rule?
    p {
      color: red;
      font-weight: bold;
      font-style: italic;
      text-align: center;
    }
    (a) 10px (b) text-align (c) center (d) yellow
  30. 30.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  31. 31.🌈 Which hex code is red? (a) #00ff00 (b) #0000ff (c) #ff0000 (d) #ffff00
  32. 32.What does font-weight do? (a) makes the text bold (b) centres a heading (c) sets the letter colour (d) makes letters bigger
  33. 33.🖌️ What colour is behind the letters?
    h2 {
      background-color: yellow;
      text-align: right;
      color: purple;
      font-size: 40px;
    }
    (a) red (b) purple (c) yellow
  34. 34.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
  35. 35.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) flex-end (d) space-between
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
  37. 37.What does justify-content: space-between do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  38. 38.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) blue (d) white
  39. 39.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    .note { color: white; }
    .note { color: blue; }
    (a) blue (b) black (c) white (d) yellow
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    #intro { color: white; }
    #intro { color: black; }
    (a) blue (b) black (c) white (d) purple

Answer key

  1. 191
  2. blue
  3. space inside the border
  4. 12
  5. a class selector
  6. CSS
  7. Yes
  8. fits every screen
  9. <h1 class="note">
  10. content
  11. No
  12. 91
  13. justify-content
  14. yellow
  15. 20
  16. the later one
  17. 220
  18. font-weight
  19. space-between
  20. <style>
  21. HTML
  22. #
  23. flex-end
  24. margin
  25. text-align
  26. 24
  27. No
  28. 20
  29. center
  30. 10
  31. #ff0000
  32. makes the text bold
  33. yellow
  34. border
  35. flex-start
  36. 3
  37. equal gaps, none at ends
  38. blue
  39. blue
  40. black

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