← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 113 · 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.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 100 (c) 255 (d) 99
  2. 2.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  3. 3.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  4. 4.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
  5. 5.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
  6. 6.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
  7. 7.🎯 Which element does the selector .note style? (a) <li class="big"> (b) <li class="note"> (c) <li id="note"> (d) <div class="red">
  8. 8.🖌️ What colour is behind the letters?
    li {
      color: red;
      text-align: center;
      background-color: black;
      font-size: 16px;
    }
    (a) red (b) black (c) purple
  9. 9.True or false: the content is the gap to other boxes. (a) False (b) True
  10. 10.True or false: HTML makes a form box. (a) False (b) True
  11. 11.True or false: #hero is an element selector. (a) False (b) True
  12. 12.🌈 Which hex code is black? (a) #000000 (b) #ff00ff (c) #ffffff (d) #0000ff
  13. 13.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 420px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  15. 15.✍️ What value is given to margin in this rule?
    h2 {
      margin: 10px;
      color: red;
    }
    (a) 10px (b) margin (c) 8px (d) bold
  16. 16.What does justify-content: flex-end do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  17. 17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  18. 18.🌈 Which colour of light is strongest in rgb(74, 121, 241)? (a) blue (b) red (c) green
  19. 19.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    p { color: orange; }
    p { color: black; }
    (a) purple (b) green (c) black (d) orange
  20. 20.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  21. 21.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="box" id="intro">Hi</h2>
    CSS:
    #intro { color: red; }
    #intro { color: orange; }
    (a) blue (b) red (c) orange (d) purple
  23. 23.🌈 Which colour is #00ffff? (a) blue (b) yellow (c) red (d) cyan
  24. 24.What does font-size do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) makes the text bold
  25. 25.✍️ In color: blue; which part is the property? (a) : (b) ; (c) color (d) blue
  26. 26.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-start (d) flex-end
  27. 27.True or false: the content is the text or picture. (a) True (b) False
  28. 28.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  29. 29.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) padding (d) border
  30. 30.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  31. 31.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  32. 32.What does font-weight do? (a) colours behind the text (b) makes letters bigger (c) sets the letter colour (d) makes the text bold
  33. 33.🎯 Which element does the selector .menu style? (a) <div class="note"> (b) <span class="big"> (c) <div class="menu"> (d) <div id="menu">
  34. 34.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) display: flex (c) justify-content (d) gap
  35. 35.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) blue (c) black (d) white
  36. 36.True or false: padding is space inside the border. (a) False (b) True
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: red; }
    (a) white (b) black (c) red (d) yellow
  38. 38.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-family (d) font-size
  39. 39.🎯 Which CSS selector matches this element?
    <h2 class="red" id="hero">Hello</h2>
    (a) .box (b) #top (c) .hero (d) h2
  40. 40.True or false: margin is space inside the border. (a) False (b) True

Answer key

  1. 255
  2. Yes
  3. <link>
  4. 1
  5. blue
  6. blue
  7. <li class="note">
  8. black
  9. False
  10. True
  11. False
  12. #000000
  13. 242
  14. 10
  15. 10px
  16. packs boxes at the end
  17. 12
  18. blue
  19. black
  20. 16
  21. flex-start
  22. orange
  23. cyan
  24. makes letters bigger
  25. color
  26. flex-end
  27. True
  28. JavaScript
  29. border
  30. No
  31. an element selector
  32. makes the text bold
  33. <div class="menu">
  34. gap
  35. black
  36. True
  37. red
  38. background-color
  39. h2
  40. False

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