← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 12 · 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.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
  2. 2.🖌️ What colour is behind the letters?
    h1 {
      text-align: left;
      background-color: orange;
      color: yellow;
      font-size: 36px;
    }
    (a) yellow (b) blue (c) orange
  3. 3.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .png (d) .js
  4. 4.✍️ Which property is set to 20px in this rule?
    h1 {
      text-align: center;
      color: red;
      margin: 10px;
      font-size: 20px;
    }
    (a) background-color (b) 20px (c) text-align (d) font-size
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: orange; }
    .note { color: yellow; }
    (a) orange (b) black (c) yellow (d) blue
  6. 6.🔍 Which is the odd one out? (a) counts down a timer (b) makes a form box (c) checks a quiz answer (d) reacts to a button click
  7. 7.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  8. 8.🖌️ How big is the text, in px?
    p {
      background-color: white;
      font-size: 12px;
      color: black;
      text-align: left;
    }
  9. 9.📦 In the box model, which part is a solid or dotted edge? (a) border (b) content (c) margin (d) padding
  10. 10.🎨 Which attribute adds CSS inside one tag? (a) href (b) style (c) alt (d) src
  11. 11.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) yellow (c) cyan (d) blue
  12. 12.True or false: HTML makes a link. (a) False (b) True
  13. 13.✍️ What value is given to padding in this rule?
    .box {
      font-weight: bold;
      padding: 8px;
    }
    (a) bold (b) 8px (c) padding (d) 2px solid
  14. 14.🎯 Which CSS selector matches this element?
    <p class="big" id="logo">Hello</p>
    (a) #big (b) p (c) #end (d) .logo
  15. 15.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 160px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  16. 16.✍️ What is the selector in this CSS rule?
    h1 {
      font-style: italic;
      font-size: 20px;
      width: 300px;
    }
    (a) font-style (b) 20px (c) h1 (d) p
  17. 17.True or false: HTML checks a quiz answer. (a) True (b) False
  18. 18.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  19. 19.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    .red { color: purple; }
    h2 { color: black; }
    #top { color: white; }
    (a) black (b) purple (c) white (d) blue
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    .star { color: yellow; }
    .star { color: orange; }
    (a) orange (b) purple (c) yellow (d) blue
  21. 21.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) space-between (d) flex-end
  22. 22.✍️ What value is given to padding in this rule?
    h2 {
      font-size: 20px;
      text-align: center;
      background-color: yellow;
      padding: 8px;
    }
    (a) padding (b) bold (c) 2px solid (d) 8px
  23. 23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  24. 24.🖌️ What colour are the letters?
    h1 {
      background-color: red;
      color: yellow;
      font-size: 16px;
      text-align: right;
    }
    (a) green (b) yellow (c) red
  25. 25.True or false: padding is the gap round content. (a) False (b) True
  26. 26.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) border (d) padding
  27. 27.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) green (d) blue
  28. 28.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
  29. 29.🎯 Which element does the selector #end style? (a) <h1 class="big"> (b) <p id="end"> (c) <p id="hero"> (d) <p class="end">
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 350px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  31. 31.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    .star { color: purple; }
    p { color: orange; }
    #intro { color: blue; }
    (a) red (b) blue (c) orange (d) purple
  32. 32.True or false: JavaScript puts a picture on a page. (a) True (b) False
  33. 33.🌈 Which colour of light is strongest in rgb(222, 63, 75)? (a) blue (b) red (c) green
  34. 34.Which of these does HTML do? (a) checks a quiz answer (b) makes a link (c) adds space around boxes (d) reacts to a button click
  35. 35.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
  36. 36.🖌️ Which CSS property sets the letter colour? (a) font-size (b) background-color (c) font-family (d) color
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      background-color: yellow;
      border: 2px solid;
      margin: 10px;
      color: red;
    }
  38. 38.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    .big { color: white; }
    #logo { color: orange; }
    (a) green (b) orange (c) white (d) purple
  39. 39.🎯 Which element does the selector h2 style? (a) <div class="big"> (b) <li> (c) <h2 class="big"> (d) <span id="intro">
  40. 40.True or false: HTML makes headings and lists. (a) False (b) True

Answer key

  1. 600px or narrower
  2. orange
  3. .css
  4. font-size
  5. orange
  6. makes a form box
  7. Yes
  8. 12
  9. border
  10. style
  11. blue
  12. True
  13. 8px
  14. p
  15. 212
  16. h1
  17. False
  18. Yes
  19. white
  20. orange
  21. space-between
  22. 8px
  23. 20
  24. yellow
  25. True
  26. padding
  27. blue
  28. HTML
  29. <p id="end">
  30. 30
  31. blue
  32. False
  33. red
  34. makes a link
  35. <link>
  36. color
  37. 4
  38. orange
  39. <h2 class="big">
  40. True

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