← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 619 · 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 colour is rgb(255, 255, 255)? (a) red (b) blue (c) black (d) white
  2. 2.Which of these is padding? (a) the line round the box (b) a solid or dotted edge (c) the text or picture (d) space inside the border
  3. 3.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <link> (d) <a>
  4. 4.✍️ What value is given to font-weight in this rule?
    body {
      font-weight: bold;
      font-size: 20px;
      font-style: italic;
    }
    (a) font-weight (b) bold (c) 300px (d) 2px solid
  5. 5.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) background-color (c) text-align (d) color
  6. 6.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <p class="box"> (c) <span id="intro"> (d) <span id="main">
  7. 7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  8. 8.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
  9. 9.What does background-color do? (a) makes letters bigger (b) sets the letter colour (c) centres a heading (d) colours behind the text
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      padding: 8px;
      text-align: center;
      background-color: yellow;
      font-weight: bold;
    }
  11. 11.🎨 Which tag holds CSS inside the head? (a) <body> (b) <script> (c) <css> (d) <style>
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    .box { color: black; }
    #logo { color: yellow; }
    (a) black (b) red (c) green (d) yellow
  14. 14.🖌️ Where does the text sit on its line?
    h2 {
      color: blue;
      font-size: 12px;
      background-color: purple;
      text-align: left;
    }
    (a) on the left (b) in the middle (c) on the right
  15. 15.🎯 Which CSS selector matches this element?
    <li class="note" id="logo">Hello</li>
    (a) .big (b) .note (c) .logo (d) #end
  16. 16.📦 In the box model, which part is the text or picture? (a) padding (b) margin (c) content (d) border
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-size: 20px;
      padding: 8px;
      border: 2px solid;
      background-color: yellow;
    }
  18. 18.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }
  19. 19.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: yellow; }
    (a) purple (b) blue (c) yellow (d) green
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    .menu { color: purple; }
    .menu { color: blue; }
    (a) black (b) yellow (c) purple (d) blue
  21. 21.🔍 Which is the odd one out? (a) sets colours and fonts (b) lays out the page (c) changes the page live (d) changes the text size
  22. 22.🔍 Which is the odd one out? (a) counts down a timer (b) adds space around boxes (c) lays out the page (d) changes the text size
  23. 23.🖌️ What colour are the letters?
    li {
      font-size: 12px;
      background-color: black;
      text-align: right;
      color: purple;
    }
    (a) yellow (b) purple (c) black
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      font-style: italic;
    }
  25. 25.Which of these is the content? (a) the text or picture (b) space outside the border (c) space inside the border (d) a solid or dotted edge
  26. 26.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  27. 27.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 255 (d) 100
  28. 28.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      color: red;
      background-color: yellow;
    }
    (a) red (b) font-size (c) p (d) .note
  29. 29.🎯 Can many elements share the same class? (a) Yes (b) No
  30. 30.✍️ What is the selector in this CSS rule?
    #top {
      font-weight: bold;
      margin: 10px;
      font-size: 20px;
      border: 2px solid;
    }
    (a) #top (b) 10px (c) font-weight (d) li
  31. 31.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  32. 32.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  34. 34.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
  35. 35.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the line round the box (d) the gap to other boxes
  36. 36.✍️ Which property is set to 10px in this rule?
    body {
      margin: 10px;
      font-style: italic;
      width: 300px;
      border: 2px solid;
    }
    (a) padding (b) 10px (c) font-weight (d) margin
  37. 37.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  38. 38.True or false: .card is a class selector. (a) False (b) True
  39. 39.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .js (d) .html
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).

Answer key

  1. white
  2. space inside the border
  3. <link>
  4. bold
  5. color
  6. <span id="intro">
  7. 18
  8. 1
  9. colours behind the text
  10. 4
  11. <style>
  12. 40
  13. yellow
  14. on the left
  15. .note
  16. content
  17. 4
  18. 200
  19. yellow
  20. blue
  21. changes the page live
  22. counts down a timer
  23. purple
  24. 2
  25. the text or picture
  26. Yes
  27. 255
  28. p
  29. Yes
  30. #top
  31. 16
  32. an id selector
  33. 10
  34. border
  35. the gap to other boxes
  36. margin
  37. 40
  38. True
  39. .css
  40. 40

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