← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 766 · 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: padding is the gap round content. (a) False (b) True
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    h2 { color: blue; }
    h2 { color: orange; }
    (a) blue (b) red (c) orange (d) white
  3. 3.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  4. 4.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
  5. 5.🖌️ What colour is behind the letters?
    p {
      font-size: 20px;
      text-align: right;
      background-color: red;
      color: purple;
    }
    (a) purple (b) red (c) orange
  6. 6.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  7. 7.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  8. 8.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) padding (d) content
  9. 9.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      border: 2px solid;
      font-weight: bold;
    }
    (a) li (b) text-align (c) body (d) 2px solid
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
      border: 2px solid;
      margin: 10px;
      font-size: 20px;
    }
  11. 11.🎯 What kind of selector is #end? (a) an id selector (b) a class selector (c) an element selector
  12. 12.True or false: CSS counts down a timer. (a) True (b) False
  13. 13.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      border: 2px solid;
      color: red;
    }
    (a) padding (b) #top (c) 2px solid (d) .note
  14. 14.True or false: HTML puts a picture on a page. (a) False (b) True
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 15px;
      border: 1px solid black;
      margin: 0px;
    }
  16. 16.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  17. 17.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  18. 18.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
      border: 2px solid;
      margin: 10px;
    }
  20. 20.Which of these does CSS do? (a) checks a quiz answer (b) makes headings and lists (c) reacts to a button click (d) adds space around boxes
  21. 21.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) red (c) cyan (d) white
  22. 22.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  23. 23.🌈 Which colour of light is strongest in rgb(201, 0, 55)? (a) blue (b) red (c) green
  24. 24.📦 In the box model, which part is space inside the border? (a) padding (b) content (c) margin (d) border
  25. 25.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) padding (d) border
  26. 26.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-start (d) flex-end
  27. 27.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  28. 28.🖌️ What colour are the letters?
    h2 {
      text-align: right;
      background-color: purple;
      font-size: 40px;
      color: yellow;
    }
    (a) purple (b) yellow (c) red
  29. 29.🌈 Which colour of light is strongest in rgb(234, 29, 41)? (a) red (b) green (c) blue
  30. 30.🖌️ What colour are the letters?
    p {
      background-color: green;
      color: blue;
      font-size: 16px;
      text-align: left;
    }
    (a) blue (b) green (c) red
  31. 31.🌈 Which hex code is bright green? (a) #0000ff (b) #ff00ff (c) #ffffff (d) #00ff00
  32. 32.🎯 Can many elements share the same class? (a) Yes (b) No
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
      font-style: italic;
    }
  34. 34.📦 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: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  35. 35.🎯 Which sign starts an id selector? (a) & (b) @ (c) . (d) #
  36. 36.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
  37. 37.Which of these does HTML do? (a) sets colours and fonts (b) makes headings and lists (c) rounds box corners (d) checks a quiz answer
  38. 38.🎯 Which element does the selector #logo style? (a) <h1 class="big"> (b) <p class="logo"> (c) <p id="end"> (d) <p id="logo">
  39. 39.True or false: p is an id selector. (a) True (b) False
  40. 40.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) adds space around boxes (d) puts a picture on a page

Answer key

  1. True
  2. orange
  3. 14
  4. an element selector
  5. red
  6. color
  7. HTML
  8. padding
  9. li
  10. 4
  11. an id selector
  12. False
  13. .note
  14. True
  15. 92
  16. No
  17. 136
  18. an element selector
  19. 3
  20. adds space around boxes
  21. white
  22. No
  23. red
  24. padding
  25. border
  26. space-between
  27. :
  28. yellow
  29. red
  30. blue
  31. #00ff00
  32. Yes
  33. 2
  34. 224
  35. #
  36. { }
  37. makes headings and lists
  38. <p id="logo">
  39. False
  40. puts a picture on a page

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