← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 5 · 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 does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  2. 2.True or false: margin is the gap to other boxes. (a) True (b) False
  3. 3.🔍 Which is the odd one out? (a) lays out the page (b) makes headings and lists (c) gives the page structure (d) makes a form box
  4. 4.🎯 Which element does the selector #main style? (a) <h2 class="main"> (b) <h2 id="logo"> (c) <li class="big"> (d) <h2 id="main">
  5. 5.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) magenta (c) bright green (d) red
  6. 6.🌈 Which hex code is yellow? (a) #0000ff (b) #ffff00 (c) #000000 (d) #ff00ff
  7. 7.🖌️ What colour are the letters?
    p {
      font-size: 32px;
      text-align: right;
      background-color: yellow;
      color: blue;
    }
    (a) yellow (b) blue (c) purple
  8. 8.🌈 In #000034 the blue part is the hex number 34. What is it as a normal number?
  9. 9.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) 2 (d) any number
  10. 10.True or false: HTML gives the page structure. (a) True (b) False
  11. 11.🖌️ Which CSS property sets the letter colour? (a) color (b) background-color (c) font-weight (d) font-family
  12. 12.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  13. 13.🌈 Which colour is rgb(0, 0, 0)? (a) white (b) black (c) blue (d) bright green
  14. 14.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) green (d) red
  15. 15.✍️ What is the selector in this CSS rule?
    p {
      padding: 8px;
      width: 300px;
      margin: 10px;
    }
    (a) 300px (b) padding (c) p (d) .note
  16. 16.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    p { color: red; }
    p { color: green; }
    (a) blue (b) black (c) green (d) red
  17. 17.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the text size (c) adds space around boxes (d) makes headings and lists
  18. 18.🖌️ What colour are the letters?
    h2 {
      font-size: 36px;
      background-color: blue;
      color: yellow;
      text-align: left;
    }
    (a) blue (b) red (c) yellow
  19. 19.True or false: CSS rounds box corners. (a) True (b) False
  20. 20.✍️ Which property is set to yellow in this rule?
    h2 {
      padding: 8px;
      background-color: yellow;
      width: 300px;
    }
    (a) margin (b) padding (c) yellow (d) background-color
  21. 21.🎯 Which CSS selector matches this element?
    <li class="box" id="intro">Hello</li>
    (a) #intro (b) #main (c) div (d) #box
  22. 22.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  23. 23.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 140px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  24. 24.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  25. 25.🌈 Which colour of light is strongest in rgb(61, 136, 222)? (a) red (b) green (c) blue
  26. 26.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    .menu { color: white; }
    #logo { color: red; }
    p { color: black; }
    (a) black (b) blue (c) red (d) white
  27. 27.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) makes the text bold (d) colours behind the text
  28. 28.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  29. 29.🌈 Which colour is #00ffff? (a) black (b) cyan (c) blue (d) magenta
  30. 30.🌈 Which colour of light is strongest in rgb(11, 235, 83)? (a) red (b) blue (c) green
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="red" id="end">Hi</h1>
    CSS:
    .red { color: red; }
    #end { color: blue; }
    h1 { color: white; }
    (a) blue (b) white (c) red (d) green
  32. 32.🎯 Which CSS selector matches this element?
    <div class="red" id="end">Hello</div>
    (a) #red (b) span (c) .end (d) .red
  33. 33.🖌️ Which CSS property colours behind the text? (a) font-size (b) color (c) background-color (d) font-weight
  34. 34.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) red (d) black
  35. 35.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) the gap to other boxes (d) the gap round content
  36. 36.🎯 Which element does the selector .red style? (a) <h1 class="box"> (b) <h2 class="star"> (c) <h1 class="red"> (d) <h1 id="red">
  37. 37.✍️ What is the selector in this CSS rule?
    body {
      font-weight: bold;
      background-color: yellow;
      text-align: center;
    }
    (a) .box (b) body (c) font-weight (d) yellow
  38. 38.🖌️ What colour are the letters?
    li {
      background-color: white;
      color: blue;
      font-size: 40px;
      text-align: left;
    }
    (a) blue (b) white (c) purple
  39. 39.🎯 Which CSS selector matches this element?
    <h2 class="note" id="top">Hello</h2>
    (a) .big (b) #note (c) h2 (d) .top
  40. 40.🖌️ Where does the text sit on its line?
    li {
      background-color: red;
      font-size: 12px;
      text-align: left;
      color: blue;
    }
    (a) on the right (b) on the left (c) in the middle

Answer key

  1. puts boxes in the middle
  2. True
  3. lays out the page
  4. <h2 id="main">
  5. blue
  6. #ffff00
  7. blue
  8. 52
  9. 1
  10. True
  11. color
  12. 70
  13. black
  14. blue
  15. p
  16. green
  17. makes headings and lists
  18. yellow
  19. True
  20. background-color
  21. #intro
  22. an element selector
  23. 40
  24. :
  25. blue
  26. red
  27. makes the text bold
  28. Yes
  29. cyan
  30. green
  31. blue
  32. .red
  33. background-color
  34. red
  35. the gap to other boxes
  36. <h1 class="red">
  37. body
  38. blue
  39. h2
  40. on the left

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