← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 441 · 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 kind of selector is .menu? (a) a class selector (b) an id selector (c) an element selector
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 25px;
      border: 4px solid black;
      margin: 10px;
    }
  3. 3.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <div class="menu"> (c) <h2 class="menu"> (d) <li>
  4. 4.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    .note { color: yellow; }
    h1 { color: purple; }
    #main { color: red; }
    (a) purple (b) black (c) yellow (d) red
  6. 6.🖌️ What colour is behind the letters?
    h1 {
      font-size: 28px;
      background-color: blue;
      text-align: right;
      color: yellow;
    }
    (a) blue (b) purple (c) yellow
  7. 7.💪 Which flexbox property lines boxes up across? (a) gap (b) justify-content (c) align-items (d) flex-direction
  8. 8.True or false: HTML changes the text size. (a) False (b) True
  9. 9.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  10. 10.🖌️ What colour are the letters?
    p {
      font-size: 12px;
      background-color: green;
      color: blue;
      text-align: center;
    }
    (a) green (b) red (c) blue
  11. 11.Which of these does CSS do? (a) makes a form box (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  13. 13.Which of these does HTML do? (a) makes headings and lists (b) adds space around boxes (c) reacts to a button click (d) rounds box corners
  14. 14.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) cyan (c) bright green (d) blue
  15. 15.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
  16. 16.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  17. 17.🎯 Which CSS selector matches this element?
    <span class="menu" id="end">Hello</span>
    (a) #menu (b) span (c) .end (d) #hero
  18. 18.Which of these does HTML do? (a) makes a form box (b) checks a quiz answer (c) changes the page live (d) shows a pop-up message
  19. 19.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) .end (b) #hero (c) #end (d) h1
  20. 20.✍️ Which property is set to bold in this rule?
    h2 {
      font-size: 20px;
      text-align: center;
      font-weight: bold;
    }
    (a) font-weight (b) width (c) border (d) bold
  21. 21.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :
  22. 22.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      background-color: orange;
      color: red;
      font-size: 20px;
    }
    (a) in the middle (b) on the left (c) on the right
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 3px solid black;
      margin: 10px;
    }
  24. 24.💪 Which flexbox property sets space between boxes? (a) align-items (b) flex-direction (c) display: flex (d) gap
  25. 25.🖌️ How big is the text, in px?
    li {
      text-align: left;
      color: yellow;
      font-size: 16px;
      background-color: black;
    }
  26. 26.✍️ Which property is set to yellow in this rule?
    #top {
      font-style: italic;
      background-color: yellow;
      color: red;
      font-size: 20px;
    }
    (a) margin (b) background-color (c) padding (d) yellow
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  28. 28.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes a link (d) adds space around boxes
  29. 29.True or false: #top is an id selector. (a) False (b) True
  30. 30.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) flex-start (d) space-between
  31. 31.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: white; }
    (a) green (b) yellow (c) blue (d) white
  33. 33.✍️ Which property is set to red in this rule?
    .note {
      background-color: yellow;
      font-weight: bold;
      color: red;
    }
    (a) color (b) red (c) text-align (d) font-size
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    .note { color: blue; }
    .note { color: purple; }
    (a) purple (b) black (c) red (d) blue
  36. 36.True or false: padding is a solid or dotted edge. (a) True (b) False
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
      width: 300px;
    }
  38. 38.True or false: #hero is an element selector. (a) False (b) True
  39. 39.🖌️ Which CSS property colours behind the text? (a) background-color (b) text-align (c) font-weight (d) font-family
  40. 40.🌈 Which colour of light is strongest in rgb(211, 31, 109)? (a) green (b) blue (c) red

Answer key

  1. a class selector
  2. 268
  3. <h2 class="menu">
  4. { }
  5. red
  6. blue
  7. align-items
  8. False
  9. :
  10. blue
  11. sets colours and fonts
  12. 20
  13. makes headings and lists
  14. bright green
  15. blue
  16. an id selector
  17. span
  18. makes a form box
  19. #end
  20. font-weight
  21. blue
  22. on the left
  23. 126
  24. gap
  25. 16
  26. background-color
  27. 50
  28. adds space around boxes
  29. True
  30. space-between
  31. <style>
  32. white
  33. color
  34. 60
  35. purple
  36. False
  37. 2
  38. False
  39. background-color
  40. red

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