← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 563 · 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 justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) flex-end (d) center
  2. 2.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      background-color: yellow;
      font-size: 20px;
      color: red;
    }
  3. 3.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
  4. 4.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) .intro (b) .star (c) div (d) #main
  5. 5.What does font-family do? (a) makes the text bold (b) picks the font style (c) sets the letter colour (d) makes letters bigger
  6. 6.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  7. 7.✍️ What value is given to padding in this rule?
    .box {
      padding: 8px;
      font-weight: bold;
    }
    (a) 2px solid (b) padding (c) 8px (d) bold
  8. 8.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
  9. 9.🖌️ What colour is behind the letters?
    h1 {
      font-size: 28px;
      color: black;
      background-color: yellow;
      text-align: right;
    }
    (a) yellow (b) black (c) red
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    #end { color: white; }
    .box { color: blue; }
    h2 { color: red; }
    (a) green (b) blue (c) white (d) red
  11. 11.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  12. 12.What does text-align do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) picks the font style
  13. 13.🖌️ What colour are the letters?
    h1 {
      font-size: 16px;
      text-align: left;
      color: white;
      background-color: orange;
    }
    (a) orange (b) yellow (c) white
  14. 14.🌈 Which colour is #ffff00? (a) cyan (b) yellow (c) magenta (d) bright green
  15. 15.True or false: #main is an id selector. (a) True (b) False
  16. 16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  17. 17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    #intro { color: yellow; }
    #intro { color: blue; }
    (a) black (b) yellow (c) blue (d) white
  19. 19.🌈 Which hex code is bright green? (a) #00ffff (b) #ffffff (c) #00ff00 (d) #000000
  20. 20.True or false: HTML makes a form box. (a) True (b) False
  21. 21.🖌️ What colour are the letters?
    li {
      text-align: left;
      background-color: green;
      color: blue;
      font-size: 28px;
    }
    (a) white (b) blue (c) green
  22. 22.Which of these does CSS do? (a) makes a link (b) changes the page live (c) rounds box corners (d) makes a form box
  23. 23.🔍 Which is the odd one out? (a) changes the page live (b) puts a picture on a page (c) makes headings and lists (d) makes a link
  24. 24.True or false: the content is the text or picture. (a) False (b) True
  25. 25.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
  26. 26.🌈 Which hex code is blue? (a) #ffff00 (b) #0000ff (c) #ff00ff (d) #ffffff
  27. 27.💪 Which flexbox property spaces boxes along a row? (a) gap (b) align-items (c) flex-direction (d) justify-content
  28. 28.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
  29. 29.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) red (c) bright green (d) black
  30. 30.✍️ In color: blue; which part is the property? (a) : (b) color (c) ; (d) blue
  31. 31.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    p { color: blue; }
    #end { color: black; }
    (a) blue (b) purple (c) white (d) black
  32. 32.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 20px;
      border: 5px solid black;
      margin: 10px;
    }
  33. 33.💪 Which justify-content value packs boxes at the end? (a) center (b) space-between (c) flex-start (d) flex-end
  34. 34.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) # (d) //
  35. 35.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) gap
  36. 36.🖌️ What colour is behind the letters?
    li {
      text-align: center;
      color: green;
      font-size: 36px;
      background-color: yellow;
    }
    (a) green (b) black (c) yellow
  37. 37.True or false: the content is space inside the border. (a) False (b) True
  38. 38.🖌️ Which CSS property sets the letter colour? (a) text-align (b) color (c) background-color (d) font-size
  39. 39.Which of these does CSS do? (a) changes the page live (b) reacts to a button click (c) changes the text size (d) gives the page structure
  40. 40.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) white (b) green (c) purple (d) red

Answer key

  1. center
  2. 4
  3. #
  4. div
  5. picks the font style
  6. 20
  7. 8px
  8. border
  9. yellow
  10. white
  11. space-between
  12. centres a heading
  13. white
  14. yellow
  15. True
  16. 26
  17. 12
  18. blue
  19. #00ff00
  20. True
  21. blue
  22. rounds box corners
  23. changes the page live
  24. True
  25. a class selector
  26. #0000ff
  27. justify-content
  28. 255
  29. bright green
  30. color
  31. black
  32. 200
  33. flex-end
  34. /*
  35. flex-direction
  36. yellow
  37. False
  38. color
  39. changes the text size
  40. purple

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