← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 507 · 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 each gap between two boxes?
    .row {
      display: flex;
      width: 370px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  2. 2.True or false: .card is an element selector. (a) True (b) False
  3. 3.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  4. 4.🖌️ What colour is behind the letters?
    h1 {
      background-color: purple;
      color: blue;
      text-align: right;
      font-size: 12px;
    }
    (a) purple (b) orange (c) blue
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  6. 6.📦 In the box model, which part is the text or picture? (a) content (b) margin (c) padding (d) border
  7. 7.🎯 Can many elements share the same class? (a) No (b) Yes
  8. 8.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  9. 9.What does font-weight do? (a) centres a heading (b) picks the font style (c) colours behind the text (d) makes the text bold
  10. 10.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 15px;
      border: 5px solid black;
      margin: 15px;
    }
  12. 12.🔍 Which is the odd one out? (a) counts down a timer (b) changes the text size (c) checks a quiz answer (d) shows a pop-up message
  13. 13.✍️ In color: blue; which part is the value? (a) color (b) : (c) ; (d) blue
  14. 14.🖌️ How big is the text, in px?
    p {
      color: green;
      text-align: right;
      background-color: white;
      font-size: 20px;
    }
  15. 15.🖌️ Which CSS property picks the font style? (a) font-size (b) font-weight (c) font-family (d) text-align
  16. 16.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 390px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  17. 17.✍️ What value is given to margin in this rule?
    body {
      background-color: yellow;
      font-size: 20px;
      margin: 10px;
    }
    (a) margin (b) 8px (c) bold (d) 10px
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      border: 2px solid;
      font-size: 20px;
      font-style: italic;
      color: red;
    }
  19. 19.What does justify-content: center do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  21. 21.✍️ What value is given to background-color in this rule?
    .note {
      color: red;
      background-color: yellow;
    }
    (a) 10px (b) yellow (c) background-color (d) 8px
  22. 22.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: black; }
    #top { color: yellow; }
    (a) black (b) white (c) yellow (d) orange
  23. 23.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) flex-direction (d) gap
  24. 24.True or false: HTML makes headings and lists. (a) False (b) True
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  26. 26.✍️ What value is given to text-align in this rule?
    body {
      text-align: center;
      margin: 10px;
    }
    (a) text-align (b) 10px (c) center (d) yellow
  27. 27.True or false: the content is the line round the box. (a) True (b) False
  28. 28.🖌️ What colour are the letters?
    li {
      text-align: center;
      color: black;
      background-color: orange;
      font-size: 16px;
    }
    (a) orange (b) yellow (c) black
  29. 29.🌈 In #004f00 the green part is the hex number 4f. What is it as a normal number?
  30. 30.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  31. 31.✍️ What value is given to margin in this rule?
    li {
      margin: 10px;
      font-style: italic;
      width: 300px;
    }
    (a) margin (b) 10px (c) bold (d) 8px
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    .red { color: black; }
    h2 { color: orange; }
    #intro { color: green; }
    (a) orange (b) black (c) yellow (d) green
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: green; }
    h2 { color: orange; }
    .note { color: purple; }
    (a) green (b) purple (c) orange (d) black
  34. 34.What does font-family do? (a) colours behind the text (b) makes the text bold (c) picks the font style (d) centres a heading
  35. 35.True or false: the content is the gap round content. (a) False (b) True
  36. 36.True or false: JavaScript makes a link. (a) False (b) True
  37. 37.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  38. 38.✍️ What is the selector in this CSS rule?
    h1 {
      padding: 8px;
      width: 300px;
    }
    (a) p (b) 300px (c) h1 (d) padding
  39. 39.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  40. 40.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) content (d) border

Answer key

  1. 70
  2. False
  3. an element selector
  4. purple
  5. 40
  6. content
  7. Yes
  8. 28
  9. makes the text bold
  10. CSS
  11. 120
  12. changes the text size
  13. blue
  14. 20
  15. font-family
  16. 70
  17. 10px
  18. 4
  19. puts boxes in the middle
  20. 10
  21. yellow
  22. yellow
  23. display: flex
  24. True
  25. 80
  26. center
  27. False
  28. black
  29. 79
  30. 8
  31. 10px
  32. green
  33. green
  34. picks the font style
  35. False
  36. False
  37. an id selector
  38. h1
  39. 800px or wider
  40. border

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