← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 628 · 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 selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  2. 2.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
  3. 3.✍️ Which property is set to 8px in this rule?
    h2 {
      font-weight: bold;
      padding: 8px;
    }
    (a) 8px (b) padding (c) font-weight (d) border
  4. 4.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) blue (d) green
  5. 5.What does font-weight do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) centres a heading
  6. 6.✍️ What is the selector in this CSS rule?
    .box {
      padding: 8px;
      background-color: yellow;
      text-align: center;
      color: red;
    }
    (a) yellow (b) .box (c) padding (d) h2
  7. 7.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  8. 8.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: orange; }
    (a) orange (b) red (c) white (d) blue
  10. 10.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
  11. 11.🌈 Which colour is #ff00ff? (a) bright green (b) black (c) magenta (d) white
  12. 12.✍️ Which property is set to 20px in this rule?
    li {
      font-size: 20px;
      font-style: italic;
    }
    (a) font-size (b) background-color (c) text-align (d) 20px
  13. 13.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  14. 14.What does background-color do? (a) centres a heading (b) colours behind the text (c) makes letters bigger (d) makes the text bold
  15. 15.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) shows a pop-up message (d) gives the page structure
  16. 16.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  18. 18.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
  19. 19.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 100px;
      padding: 20px;
      border: 2px solid black;
      margin: 5px;
    }
  20. 20.True or false: margin is space outside the border. (a) True (b) False
  21. 21.🌈 Which colour is #000000? (a) black (b) yellow (c) red (d) bright green
  22. 22.True or false: HTML makes a form box. (a) True (b) False
  23. 23.🖌️ What colour is behind the letters?
    li {
      background-color: orange;
      text-align: right;
      font-size: 20px;
      color: yellow;
    }
    (a) blue (b) yellow (c) orange
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  25. 25.🎯 Which sign starts an id selector? (a) & (b) . (c) @ (d) #
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    .big { color: black; }
    h2 { color: purple; }
    #main { color: orange; }
    (a) yellow (b) black (c) orange (d) purple
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      width: 300px;
    }
  28. 28.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  29. 29.True or false: #logo is a class selector. (a) False (b) True
  30. 30.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  31. 31.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <script> (d) <css>
  32. 32.💪 Which flexbox property sets space between boxes? (a) justify-content (b) gap (c) align-items (d) flex-direction
  33. 33.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
  34. 34.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  35. 35.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) text-align (d) color
  36. 36.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-weight (d) font-family
  37. 37.What does font-size do? (a) makes the text bold (b) centres a heading (c) picks the font style (d) makes letters bigger
  38. 38.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  39. 39.🎯 Which sign starts a class selector? (a) . (b) # (c) @ (d) &
  40. 40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 15px;
      border: 1px solid black;
      margin: 20px;
    }

Answer key

  1. an id selector
  2. padding
  3. padding
  4. red
  5. makes the text bold
  6. .box
  7. blue
  8. equal gaps, none at ends
  9. orange
  10. color
  11. magenta
  12. font-size
  13. No
  14. colours behind the text
  15. shows a pop-up message
  16. 20
  17. 10
  18. padding
  19. 154
  20. True
  21. black
  22. True
  23. orange
  24. 142
  25. #
  26. orange
  27. 2
  28. blue
  29. False
  30. No
  31. <style>
  32. gap
  33. space-between
  34. No
  35. font-weight
  36. font-family
  37. makes letters bigger
  38. puts boxes in the middle
  39. .
  40. 182

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