← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 146 · 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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 270px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  2. 2.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) background-color (d) color
  3. 3.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 430px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  4. 4.True or false: CSS lays out the page. (a) False (b) True
  5. 5.Which of these does CSS do? (a) puts a picture on a page (b) changes the text size (c) gives the page structure (d) makes a link
  6. 6.🎯 Which CSS selector matches this element?
    <h1 class="big" id="main">Hello</h1>
    (a) .main (b) h1 (c) .red (d) #logo
  7. 7.✍️ Which property is set to 20px in this rule?
    h1 {
      font-size: 20px;
      text-align: center;
      padding: 8px;
    }
    (a) 20px (b) text-align (c) font-size (d) background-color
  8. 8.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
  9. 9.🌈 Which colour of light is strongest in rgb(38, 152, 71)? (a) green (b) blue (c) red
  10. 10.🌈 Which colour is #000000? (a) red (b) bright green (c) black (d) magenta
  11. 11.What does font-size do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
  12. 12.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) sets colours and fonts (d) changes the text size
  13. 13.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    #logo { color: white; }
    #logo { color: yellow; }
    (a) yellow (b) blue (c) green (d) white
  14. 14.True or false: .menu is an id selector. (a) True (b) False
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  16. 16.True or false: margin is space outside the border. (a) True (b) False
  17. 17.🎯 Which element does the selector .box style? (a) <p class="star"> (b) <p id="box"> (c) <p class="box"> (d) <h1 class="menu">
  18. 18.🎯 Can many elements share the same class? (a) No (b) Yes
  19. 19.True or false: the content is the text or picture. (a) True (b) False
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    h2 { color: blue; }
    .menu { color: yellow; }
    (a) purple (b) black (c) yellow (d) blue
  21. 21.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) yellow (c) blue (d) white
  22. 22.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      border: 2px solid;
      font-weight: bold;
    }
    (a) color (b) 2px solid (c) p (d) h1
  23. 23.🖌️ Which CSS property colours behind the text? (a) font-weight (b) background-color (c) text-align (d) color
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  25. 25.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the text size (c) counts down a timer (d) changes the page live
  26. 26.Which of these does CSS do? (a) checks a quiz answer (b) puts a picture on a page (c) gives the page structure (d) adds space around boxes
  27. 27.🌈 Which hex code is blue? (a) #ffffff (b) #00ffff (c) #0000ff (d) #000000
  28. 28.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) space outside the border (d) the gap round content
  29. 29.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  30. 30.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  32. 32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 170px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    h2 { color: yellow; }
    .box { color: red; }
    #main { color: black; }
    (a) orange (b) black (c) red (d) yellow
  34. 34.True or false: CSS puts a picture on a page. (a) True (b) False
  35. 35.🌈 Which colour of light is strongest in rgb(15, 86, 181)? (a) green (b) blue (c) red
  36. 36.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  37. 37.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) white (d) blue
  38. 38.What does justify-content: flex-end do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  39. 39.🔍 Which is the odd one out? (a) makes headings and lists (b) sets colours and fonts (c) changes the text size (d) lays out the page
  40. 40.🖌️ What colour are the letters?
    p {
      text-align: right;
      color: yellow;
      font-size: 20px;
      background-color: orange;
    }
    (a) yellow (b) orange (c) white

Answer key

  1. 322
  2. font-size
  3. 30
  4. True
  5. changes the text size
  6. h1
  7. font-size
  8. flex-start
  9. green
  10. black
  11. makes letters bigger
  12. gives the page structure
  13. yellow
  14. False
  15. 10
  16. True
  17. <p class="box">
  18. Yes
  19. True
  20. yellow
  21. white
  22. h1
  23. background-color
  24. 20
  25. changes the text size
  26. adds space around boxes
  27. #0000ff
  28. space outside the border
  29. /*
  30. No
  31. 40
  32. 216
  33. black
  34. False
  35. blue
  36. Yes
  37. blue
  38. packs boxes at the end
  39. makes headings and lists
  40. yellow

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