← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 963 · 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 colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    #hero { color: white; }
    #hero { color: yellow; }
    (a) purple (b) white (c) yellow (d) green
  2. 2.✍️ Which property is set to 8px in this rule?
    li {
      background-color: yellow;
      font-style: italic;
      font-weight: bold;
      padding: 8px;
    }
    (a) padding (b) border (c) font-weight (d) 8px
  3. 3.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
  4. 4.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) flex-direction (d) align-items
  5. 5.Which of these is padding? (a) the gap to other boxes (b) space outside the border (c) a solid or dotted edge (d) the gap round content
  6. 6.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    p { color: green; }
    p { color: orange; }
    (a) orange (b) white (c) purple (d) green
  7. 7.True or false: HTML reacts to a button click. (a) True (b) False
  8. 8.🎯 Which CSS selector matches this element?
    <span class="note" id="top">Hello</span>
    (a) #intro (b) .top (c) p (d) .note
  9. 9.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  10. 10.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
  11. 11.🌈 Which colour is #000000? (a) black (b) cyan (c) red (d) blue
  12. 12.✍️ What value is given to font-size in this rule?
    #top {
      font-size: 20px;
      text-align: center;
      background-color: yellow;
      font-weight: bold;
    }
    (a) yellow (b) 20px (c) center (d) font-size
  13. 13.Which of these does JavaScript do? (a) adds space around boxes (b) reacts to a button click (c) makes a form box (d) makes a link
  14. 14.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: purple; }
    (a) green (b) yellow (c) blue (d) purple
  15. 15.🎯 Can many elements share the same class? (a) No (b) Yes
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  17. 17.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <a> (d) <link>
  18. 18.✍️ Which property is set to 2px solid in this rule?
    li {
      text-align: center;
      border: 2px solid;
      font-size: 20px;
      width: 300px;
    }
    (a) 2px solid (b) border (c) font-style (d) width
  19. 19.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  20. 20.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  21. 21.🎯 Which CSS selector matches this element?
    <h1 class="star" id="intro">Hello</h1>
    (a) #main (b) h2 (c) .intro (d) #intro
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
    }
  23. 23.🌈 In #d30000 the red part is the hex number d3. What is it as a normal number?
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    h2 { color: red; }
    #top { color: yellow; }
    .note { color: purple; }
    (a) black (b) red (c) purple (d) yellow
  25. 25.🌈 Which colour of light is strongest in rgb(13, 139, 195)? (a) red (b) green (c) blue
  26. 26.Which of these does CSS do? (a) makes a link (b) gives the page structure (c) shows a pop-up message (d) changes the text size
  27. 27.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) flex-end (d) space-between
  28. 28.True or false: JavaScript makes a form box. (a) True (b) False
  29. 29.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
  30. 30.🌈 Which hex code is black? (a) #ffff00 (b) #ff0000 (c) #ff00ff (d) #000000
  31. 31.✍️ What is the selector in this CSS rule?
    p {
      padding: 8px;
      border: 2px solid;
      font-style: italic;
      text-align: center;
    }
    (a) .note (b) padding (c) 2px solid (d) p
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
      font-weight: bold;
      padding: 8px;
    }
  33. 33.🔍 Which is the odd one out? (a) checks a quiz answer (b) changes the page live (c) adds space around boxes (d) counts down a timer
  34. 34.🎯 Which element does the selector #hero style? (a) <h1 id="top"> (b) <h1 class="hero"> (c) <h1 id="hero"> (d) <h2 class="big">
  35. 35.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) black (d) blue
  36. 36.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  37. 37.🖌️ What colour are the letters?
    p {
      background-color: green;
      font-size: 20px;
      text-align: right;
      color: red;
    }
    (a) black (b) green (c) red
  38. 38.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  39. 39.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: green; }
    #intro { color: purple; }
    .big { color: orange; }
    (a) purple (b) green (c) red (d) orange
  40. 40.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) magenta (c) black (d) bright green

Answer key

  1. yellow
  2. padding
  3. :
  4. gap
  5. the gap round content
  6. orange
  7. False
  8. .note
  9. puts boxes in the middle
  10. /*
  11. black
  12. 20px
  13. reacts to a button click
  14. purple
  15. Yes
  16. 20
  17. <link>
  18. border
  19. an element selector
  20. 278
  21. #intro
  22. 1
  23. 211
  24. yellow
  25. blue
  26. changes the text size
  27. flex-end
  28. False
  29. .
  30. #000000
  31. p
  32. 3
  33. adds space around boxes
  34. <h1 id="hero">
  35. red
  36. ;
  37. red
  38. 20
  39. purple
  40. bright green

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