← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 127 · 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.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) content (d) margin
  2. 2.🌈 Which colour is #ffffff? (a) bright green (b) yellow (c) magenta (d) white
  3. 3.🎯 Which CSS selector matches this element?
    <h2 class="big" id="logo">Hello</h2>
    (a) .big (b) #end (c) .red (d) .logo
  4. 4.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) makes a link (d) rounds box corners
  5. 5.True or false: CSS sets colours and fonts. (a) True (b) False
  6. 6.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
  7. 7.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) flex-start (d) center
  8. 8.What does font-weight do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
  9. 9.True or false: #top is an id selector. (a) False (b) True
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 2px solid black;
      margin: 20px;
    }
  11. 11.🖌️ What colour is behind the letters?
    h1 {
      font-size: 20px;
      text-align: center;
      background-color: red;
      color: orange;
    }
    (a) red (b) orange (c) purple
  12. 12.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  13. 13.🌈 Which colour of light is strongest in rgb(51, 184, 78)? (a) blue (b) green (c) red
  14. 14.💪 Which flexbox property sets space between boxes? (a) gap (b) align-items (c) flex-direction (d) display: flex
  15. 15.What does color do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) makes the text bold
  16. 16.🌈 Which colour is #ff00ff? (a) yellow (b) blue (c) magenta (d) cyan
  17. 17.Which of these does CSS do? (a) counts down a timer (b) checks a quiz answer (c) makes headings and lists (d) rounds box corners
  18. 18.🖌️ What colour are the letters?
    li {
      background-color: yellow;
      color: blue;
      text-align: right;
      font-size: 32px;
    }
    (a) blue (b) red (c) yellow
  19. 19.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  20. 20.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      font-weight: bold;
      padding: 8px;
    }
    (a) body (b) text-align (c) bold (d) li
  21. 21.✍️ Which property is set to yellow in this rule?
    #top {
      background-color: yellow;
      width: 300px;
      font-size: 20px;
      margin: 10px;
    }
    (a) margin (b) yellow (c) background-color (d) padding
  22. 22.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) font-weight (d) text-align
  23. 23.Which of these does CSS do? (a) puts a picture on a page (b) shows a pop-up message (c) checks a quiz answer (d) changes the text size
  24. 24.🌈 Which colour is #00ffff? (a) blue (b) red (c) white (d) cyan
  25. 25.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  27. 27.True or false: #hero is an id selector. (a) False (b) True
  28. 28.✍️ What value is given to font-style in this rule?
    h1 {
      font-style: italic;
      font-size: 20px;
    }
    (a) font-style (b) red (c) 20px (d) italic
  29. 29.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  30. 30.🖌️ How big is the text, in px?
    h1 {
      color: yellow;
      font-size: 28px;
      background-color: white;
      text-align: left;
    }
  31. 31.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) align-items
  32. 32.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Computer Style Sheets
  33. 33.🎯 What kind of selector is li? (a) a class selector (b) an element selector (c) an id selector
  34. 34.🖌️ What colour are the letters?
    h2 {
      font-size: 20px;
      text-align: right;
      color: red;
      background-color: purple;
    }
    (a) red (b) orange (c) purple
  35. 35.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      width: 300px;
      font-size: 20px;
    }
    (a) 300px (b) #top (c) padding (d) .note
  36. 36.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) center (d) space-between
  37. 37.🎯 Which CSS selector matches this element?
    <span class="big" id="top">Hello</span>
    (a) .top (b) #big (c) .big (d) #intro
  38. 38.✍️ How does a CSS comment start? (a) # (b) /* (c) // (d) <!--
  39. 39.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  40. 40.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No

Answer key

  1. padding
  2. white
  3. .big
  4. makes a link
  5. True
  6. 3
  7. flex-start
  8. makes the text bold
  9. True
  10. 154
  11. red
  12. an id selector
  13. green
  14. gap
  15. sets the letter colour
  16. magenta
  17. rounds box corners
  18. blue
  19. Yes
  20. li
  21. background-color
  22. font-family
  23. changes the text size
  24. cyan
  25. Yes
  26. 70
  27. True
  28. italic
  29. 24
  30. 28
  31. flex-direction
  32. Cascading Style Sheets
  33. an element selector
  34. red
  35. .note
  36. space-between
  37. .big
  38. /*
  39. 192
  40. No

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