← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 947 · 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.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  2. 2.🖌️ What colour are the letters?
    p {
      background-color: black;
      font-size: 36px;
      text-align: center;
      color: blue;
    }
    (a) black (b) blue (c) red
  3. 3.🎨 Which tag holds CSS inside the head? (a) <body> (b) <css> (c) <style> (d) <script>
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  5. 5.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  6. 6.🎯 Which CSS selector matches this element?
    <span class="note" id="logo">Hello</span>
    (a) .big (b) span (c) p (d) #note
  7. 7.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  8. 8.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      color: orange;
      font-size: 36px;
      text-align: center;
    }
    (a) green (b) blue (c) orange
  9. 9.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) blue (c) cyan (d) magenta
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      font-style: italic;
      padding: 8px;
      border: 2px solid;
    }
  11. 11.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    .red { color: yellow; }
    #logo { color: blue; }
    (a) black (b) yellow (c) green (d) blue
  12. 12.🖌️ What colour are the letters?
    li {
      font-size: 32px;
      color: black;
      text-align: right;
      background-color: green;
    }
    (a) blue (b) black (c) green
  13. 13.🧩 Which language makes a form box? (a) JavaScript (b) HTML (c) CSS
  14. 14.True or false: HTML makes a link. (a) False (b) True
  15. 15.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  16. 16.🌈 In #380000 the red part is the hex number 38. What is it as a normal number?
  17. 17.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  18. 18.🖌️ What colour is behind the letters?
    p {
      font-size: 16px;
      background-color: orange;
      color: red;
      text-align: center;
    }
    (a) yellow (b) orange (c) red
  19. 19.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
  20. 20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 80px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  21. 21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  22. 22.🖌️ Where does the text sit on its line?
    h1 {
      background-color: black;
      font-size: 24px;
      color: red;
      text-align: right;
    }
    (a) on the left (b) in the middle (c) on the right
  23. 23.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
  24. 24.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-weight (c) color (d) font-size
  25. 25.🖌️ What colour is behind the letters?
    h1 {
      font-size: 16px;
      background-color: red;
      text-align: right;
      color: green;
    }
    (a) blue (b) red (c) green
  26. 26.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) green (d) red
  27. 27.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  28. 28.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  29. 29.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    .big { color: purple; }
    #logo { color: green; }
    (a) orange (b) white (c) green (d) purple
  30. 30.🎯 Which CSS selector matches this element?
    <span class="menu" id="intro">Hello</span>
    (a) #menu (b) #main (c) .intro (d) #intro
  31. 31.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
  32. 32.True or false: body is an element selector. (a) False (b) True
  33. 33.True or false: #logo is an id selector. (a) False (b) True
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  35. 35.🌈 In #840000 the red part is the hex number 84. What is it as a normal number?
  36. 36.True or false: JavaScript counts down a timer. (a) False (b) True
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
    }
  38. 38.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: orange; }
    p { color: yellow; }
    (a) green (b) orange (c) black (d) yellow
  39. 39.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
  40. 40.🖌️ Where does the text sit on its line?
    h1 {
      background-color: black;
      color: blue;
      text-align: left;
      font-size: 20px;
    }
    (a) on the right (b) on the left (c) in the middle

Answer key

  1. an element selector
  2. blue
  3. <style>
  4. 162
  5. packs boxes at the start
  6. span
  7. puts boxes in the middle
  8. orange
  9. magenta
  10. 4
  11. blue
  12. black
  13. HTML
  14. True
  15. CSS
  16. 56
  17. flex-start
  18. orange
  19. a class selector
  20. 102
  21. 20
  22. on the right
  23. an id selector
  24. font-size
  25. red
  26. blue
  27. 292
  28. Yes
  29. green
  30. #intro
  31. content
  32. True
  33. True
  34. 212
  35. 132
  36. True
  37. 1
  38. yellow
  39. Cascading Style Sheets
  40. on the left

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