← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 407 · 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.True or false: HTML makes a form box. (a) True (b) False
  2. 2.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) 5 (d) any number
  3. 3.✍️ Which property is set to yellow in this rule?
    body {
      width: 300px;
      background-color: yellow;
    }
    (a) margin (b) yellow (c) padding (d) background-color
  4. 4.🌈 Which colour is rgb(255, 0, 255)? (a) bright green (b) red (c) magenta (d) white
  5. 5.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 1px solid black;
      margin: 20px;
    }
  6. 6.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-start (c) flex-end (d) center
  7. 7.🖌️ What colour are the letters?
    li {
      background-color: yellow;
      font-size: 12px;
      text-align: center;
      color: blue;
    }
    (a) blue (b) purple (c) yellow
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  9. 9.🎯 Which element does the selector li style? (a) <li class="box"> (b) <div> (c) <p id="end"> (d) <span class="box">
  10. 10.🌈 Which colour of light is strongest in rgb(47, 101, 153)? (a) green (b) red (c) blue
  11. 11.True or false: HTML counts down a timer. (a) True (b) False
  12. 12.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: purple; }
    #end { color: black; }
    (a) purple (b) orange (c) red (d) black
  14. 14.✍️ Which property is set to center in this rule?
    p {
      font-size: 20px;
      text-align: center;
    }
    (a) text-align (b) center (c) background-color (d) margin
  15. 15.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) black (d) green
  16. 16.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      font-weight: bold;
      font-style: italic;
    }
  18. 18.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) center (d) flex-end
  19. 19.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    .big { color: blue; }
    .big { color: yellow; }
    (a) orange (b) yellow (c) purple (d) blue
  20. 20.🎯 Which CSS selector matches this element?
    <li class="big" id="top">Hello</li>
    (a) #intro (b) .big (c) div (d) .red
  21. 21.🎯 Can many elements share the same class? (a) No (b) Yes
  22. 22.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  23. 23.🎯 Which element does the selector #logo style? (a) <h2 id="end"> (b) <li class="menu"> (c) <h2 class="logo"> (d) <h2 id="logo">
  24. 24.🖌️ What colour are the letters?
    h1 {
      font-size: 28px;
      background-color: black;
      text-align: right;
      color: purple;
    }
    (a) orange (b) purple (c) black
  25. 25.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
  26. 26.🖌️ How big is the text, in px?
    p {
      background-color: yellow;
      color: orange;
      font-size: 32px;
      text-align: right;
    }
  27. 27.🌈 In #720000 the red part is the hex number 72. What is it as a normal number?
  28. 28.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
    }
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  31. 31.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: purple; }
    (a) purple (b) red (c) blue (d) yellow
  33. 33.✍️ Which property is set to 300px in this rule?
    .box {
      width: 300px;
      text-align: center;
      font-size: 20px;
      background-color: yellow;
    }
    (a) 300px (b) width (c) font-style (d) color
  34. 34.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
  35. 35.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
  36. 36.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) J (c) G (d) F
  37. 37.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) flex-end (d) center
  38. 38.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  39. 39.True or false: .big is an id selector. (a) True (b) False
  40. 40.True or false: JavaScript sets colours and fonts. (a) False (b) True

Answer key

  1. True
  2. 1
  3. background-color
  4. magenta
  5. 132
  6. space-between
  7. blue
  8. 30
  9. <li class="box">
  10. blue
  11. False
  12. 20
  13. black
  14. text-align
  15. red
  16. an element selector
  17. 3
  18. flex-start
  19. yellow
  20. .big
  21. Yes
  22. Yes
  23. <h2 id="logo">
  24. purple
  25. a class selector
  26. 32
  27. 114
  28. /*
  29. 1
  30. 70
  31. <style>
  32. purple
  33. width
  34. HTML
  35. :
  36. F
  37. flex-end
  38. Yes
  39. False
  40. False

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