← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 726 · 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 CSS selector matches this element?
    <span class="box" id="hero">Hello</span>
    (a) .hero (b) .star (c) span (d) #box
  2. 2.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) shows a pop-up message (d) changes the text size
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  4. 4.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  5. 5.True or false: .menu is an id selector. (a) False (b) True
  6. 6.🌈 Which colour is #00ff00? (a) yellow (b) red (c) magenta (d) bright green
  7. 7.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  8. 8.True or false: CSS makes a link. (a) False (b) True
  9. 9.True or false: the content is the gap round content. (a) False (b) True
  10. 10.What does font-family do? (a) makes the text bold (b) picks the font style (c) centres a heading (d) colours behind the text
  11. 11.✍️ Which property is set to 10px in this rule?
    .box {
      margin: 10px;
      width: 300px;
    }
    (a) font-weight (b) margin (c) padding (d) 10px
  12. 12.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
  13. 13.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) center (d) flex-end
  14. 14.✍️ What value is given to border in this rule?
    body {
      font-weight: bold;
      font-style: italic;
      border: 2px solid;
      width: 300px;
    }
    (a) 300px (b) border (c) italic (d) 2px solid
  15. 15.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-end (c) space-between (d) flex-start
  16. 16.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  17. 17.📦 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: 5px;
      border: 1px solid black;
      margin: 0px;
    }
  18. 18.🌈 Which hex code is red? (a) #ffff00 (b) #000000 (c) #ff0000 (d) #0000ff
  19. 19.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  21. 21.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
  22. 22.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the br tag (c) the hr tag (d) the title tag
  23. 23.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    p { color: red; }
    (a) orange (b) red (c) green (d) purple
  24. 24.🌈 Which colour of light is strongest in rgb(180, 54, 14)? (a) blue (b) green (c) red
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 30px;
      border: 2px solid black;
      margin: 15px;
    }
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  27. 27.True or false: body is an id selector. (a) True (b) False
  28. 28.✍️ What is the selector in this CSS rule?
    body {
      border: 2px solid;
      font-size: 20px;
      margin: 10px;
    }
    (a) border (b) body (c) 20px (d) .box
  29. 29.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
  30. 30.🖌️ How big is the text, in px?
    p {
      background-color: red;
      color: white;
      text-align: right;
      font-size: 28px;
    }
  31. 31.🖌️ Which CSS property makes the text bold? (a) color (b) font-weight (c) background-color (d) font-size
  32. 32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  33. 33.🌈 Which colour is #ff0000? (a) red (b) yellow (c) black (d) white
  34. 34.🖌️ Which CSS property sets the letter colour? (a) font-family (b) font-size (c) font-weight (d) color
  35. 35.What does background-color do? (a) makes letters bigger (b) picks the font style (c) makes the text bold (d) colours behind the text
  36. 36.🖌️ How big is the text, in px?
    p {
      background-color: orange;
      font-size: 40px;
      color: yellow;
      text-align: center;
    }
  37. 37.🌈 Which colour of light is strongest in rgb(16, 114, 242)? (a) green (b) blue (c) red
  38. 38.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  39. 39.🖌️ What colour are the letters?
    p {
      text-align: center;
      color: green;
      background-color: red;
      font-size: 28px;
    }
    (a) red (b) green (c) blue
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-size: 20px;
      color: red;
      padding: 8px;
      text-align: center;
    }

Answer key

  1. span
  2. changes the text size
  3. 60
  4. { }
  5. False
  6. bright green
  7. flex-start
  8. False
  9. False
  10. picks the font style
  11. margin
  12. .
  13. center
  14. 2px solid
  15. space-between
  16. 20
  17. 162
  18. #ff0000
  19. border
  20. 60
  21. an element selector
  22. the viewport meta tag
  23. red
  24. red
  25. 374
  26. 70
  27. False
  28. body
  29. HTML
  30. 28
  31. font-weight
  32. 20
  33. red
  34. color
  35. colours behind the text
  36. 40
  37. blue
  38. an element selector
  39. green
  40. 4

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