← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 107 · 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 of these is the border? (a) space inside the border (b) space outside the border (c) the text or picture (d) the line round the box
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    .big { color: orange; }
    .big { color: white; }
    (a) green (b) white (c) blue (d) orange
  3. 3.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) center (d) flex-start
  4. 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
  5. 5.🖌️ What colour is behind the letters?
    p {
      color: orange;
      text-align: center;
      font-size: 32px;
      background-color: blue;
    }
    (a) orange (b) blue (c) yellow
  6. 6.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      font-style: italic;
      margin: 10px;
    }
    (a) h1 (b) h2 (c) border (d) italic
  7. 7.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  8. 8.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 15px;
      border: 4px solid black;
      margin: 0px;
    }
  9. 9.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    .menu { color: orange; }
    #logo { color: red; }
    (a) purple (b) blue (c) red (d) orange
  11. 11.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  12. 12.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
  13. 13.🌈 Which hex code is black? (a) #00ff00 (b) #000000 (c) #00ffff (d) #ffff00
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    h1 { color: purple; }
    .note { color: white; }
    #top { color: yellow; }
    (a) yellow (b) purple (c) green (d) white
  15. 15.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  16. 16.🖌️ Which CSS property sets the letter colour? (a) color (b) font-weight (c) background-color (d) font-family
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      text-align: center;
      font-style: italic;
    }
  18. 18.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      color: red;
      font-size: 20px;
    }
  20. 20.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  21. 21.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  22. 22.✍️ Which property is set to 300px in this rule?
    .note {
      width: 300px;
      color: red;
    }
    (a) font-style (b) 300px (c) color (d) width
  23. 23.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or wider (d) 600px or narrower
  24. 24.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) gap (c) justify-content (d) display: flex
  25. 25.What does justify-content: flex-end do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  26. 26.What does background-color do? (a) makes the text bold (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
  27. 27.✍️ What is the selector in this CSS rule?
    h1 {
      background-color: yellow;
      color: red;
    }
    (a) red (b) background-color (c) p (d) h1
  28. 28.🎯 Which element does the selector h2 style? (a) <h2 class="star"> (b) <li> (c) <div class="star"> (d) <span id="intro">
  29. 29.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
  30. 30.🔍 Which is the odd one out? (a) shows a pop-up message (b) counts down a timer (c) checks a quiz answer (d) adds space around boxes
  31. 31.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  32. 32.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 20px;
      border: 1px solid black;
      margin: 20px;
    }
  33. 33.🌈 Which hex code is magenta? (a) #00ff00 (b) #0000ff (c) #ffff00 (d) #ff00ff
  34. 34.True or false: #end is an id selector. (a) False (b) True
  35. 35.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  36. 36.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 420px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  37. 37.🌈 Which hex code is white? (a) #000000 (b) #ff00ff (c) #00ffff (d) #ffffff
  38. 38.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) black (d) green
  39. 39.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  40. 40.🎯 Can many elements share the same class? (a) Yes (b) No

Answer key

  1. the line round the box
  2. white
  3. flex-start
  4. F
  5. blue
  6. h2
  7. Yes
  8. 138
  9. 12
  10. red
  11. 20
  12. #
  13. #000000
  14. yellow
  15. 12
  16. color
  17. 3
  18. color
  19. 3
  20. HTML
  21. 248
  22. width
  23. 600px or narrower
  24. display: flex
  25. packs boxes at the end
  26. colours behind the text
  27. h1
  28. <h2 class="star">
  29. .
  30. adds space around boxes
  31. 22
  32. 222
  33. #ff00ff
  34. True
  35. the later one
  36. 60
  37. #ffffff
  38. red
  39. CSS
  40. Yes

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