← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 596 · 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 of light is strongest in rgb(157, 56, 9)? (a) green (b) red (c) blue
  2. 2.🎯 Which element does the selector .note style? (a) <h2 id="note"> (b) <h2 class="note"> (c) <li class="red"> (d) <h2 class="big">
  3. 3.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    p { color: blue; }
    p { color: green; }
    (a) white (b) green (c) blue (d) purple
  4. 4.🌈 Which colour is #00ffff? (a) cyan (b) magenta (c) white (d) yellow
  5. 5.💪 Which flexbox property picks row or column? (a) justify-content (b) align-items (c) flex-direction (d) display: flex
  6. 6.✍️ What value is given to background-color in this rule?
    body {
      font-size: 20px;
      background-color: yellow;
    }
    (a) background-color (b) 10px (c) yellow (d) 8px
  7. 7.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    .star { color: orange; }
    #top { color: purple; }
    p { color: yellow; }
    (a) orange (b) yellow (c) green (d) purple
  8. 8.✍️ What is the selector in this CSS rule?
    h2 {
      font-weight: bold;
      text-align: center;
    }
    (a) font-weight (b) h2 (c) center (d) h1
  9. 9.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap round content (d) the line round the box
  10. 10.🎯 Which CSS selector matches this element?
    <p class="menu" id="end">Hello</p>
    (a) h1 (b) .end (c) .menu (d) #menu
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
    }
  12. 12.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  13. 13.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  14. 14.True or false: padding is the text or picture. (a) False (b) True
  15. 15.🖌️ How big is the text, in px?
    h1 {
      font-size: 28px;
      background-color: yellow;
      text-align: left;
      color: white;
    }
  16. 16.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    .box { color: green; }
    .box { color: blue; }
    (a) orange (b) blue (c) purple (d) green
  17. 17.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-family (c) background-color (d) color
  18. 18.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  19. 19.🎯 What kind of selector is .note? (a) an id selector (b) an element selector (c) a class selector
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      font-style: italic;
      text-align: center;
      background-color: yellow;
    }
  21. 21.✍️ Which property is set to 10px in this rule?
    h1 {
      margin: 10px;
      font-size: 20px;
      border: 2px solid;
    }
    (a) padding (b) margin (c) font-weight (d) 10px
  22. 22.🖌️ What colour are the letters?
    h2 {
      background-color: white;
      text-align: right;
      font-size: 40px;
      color: orange;
    }
    (a) white (b) black (c) orange
  23. 23.✍️ Which property is set to 300px in this rule?
    .note {
      width: 300px;
      font-size: 20px;
    }
    (a) 300px (b) width (c) color (d) font-style
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  25. 25.🔍 Which is the odd one out? (a) sets colours and fonts (b) makes a link (c) puts a picture on a page (d) gives the page structure
  26. 26.✍️ What value is given to background-color in this rule?
    h2 {
      background-color: yellow;
      font-size: 20px;
      color: red;
    }
    (a) background-color (b) 8px (c) yellow (d) 10px
  27. 27.What does font-size do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) makes letters bigger
  28. 28.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
  29. 29.✍️ What is the selector in this CSS rule?
    body {
      font-weight: bold;
      color: red;
      border: 2px solid;
    }
    (a) .box (b) font-weight (c) red (d) body
  30. 30.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  31. 31.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
  32. 32.What does justify-content: center do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  33. 33.🎯 Which sign starts a class selector? (a) @ (b) . (c) # (d) &
  34. 34.What does text-align do? (a) centres a heading (b) picks the font style (c) makes the text bold (d) makes letters bigger
  35. 35.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <div class="star"> (c) <div class="box"> (d) <span class="menu">
  36. 36.✍️ Which property is set to red in this rule?
    #top {
      background-color: yellow;
      color: red;
      margin: 10px;
    }
    (a) font-size (b) text-align (c) red (d) color
  37. 37.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  38. 38.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
      width: 300px;
      text-align: center;
      padding: 8px;
    }
  40. 40.🎯 Which CSS selector matches this element?
    <p class="menu" id="main">Hello</p>
    (a) h1 (b) #menu (c) .menu (d) .main

Answer key

  1. red
  2. <h2 class="note">
  3. green
  4. cyan
  5. flex-direction
  6. yellow
  7. purple
  8. h2
  9. the text or picture
  10. .menu
  11. 1
  12. No
  13. <link>
  14. False
  15. 28
  16. blue
  17. background-color
  18. 50
  19. a class selector
  20. 4
  21. margin
  22. orange
  23. width
  24. 50
  25. sets colours and fonts
  26. yellow
  27. makes letters bigger
  28. .css
  29. body
  30. an id selector
  31. an id selector
  32. puts boxes in the middle
  33. .
  34. centres a heading
  35. <div class="box">
  36. color
  37. No
  38. 3
  39. 4
  40. .menu

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