← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 614 · 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.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  2. 2.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
  3. 3.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) counts down a timer (d) lays out the page
  4. 4.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  5. 5.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
  6. 6.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  7. 7.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-size (d) text-align
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  9. 9.✍️ What is the selector in this CSS rule?
    .box {
      text-align: center;
      background-color: yellow;
      font-weight: bold;
      font-size: 20px;
    }
    (a) yellow (b) h2 (c) text-align (d) .box
  10. 10.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-end (c) flex-start (d) space-between
  11. 11.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 100 (c) 1000 (d) 99
  12. 12.✍️ What is the selector in this CSS rule?
    p {
      font-weight: bold;
      font-style: italic;
    }
    (a) .note (b) p (c) italic (d) font-weight
  13. 13.✍️ What value is given to background-color in this rule?
    p {
      width: 300px;
      background-color: yellow;
    }
    (a) 8px (b) 10px (c) yellow (d) background-color
  14. 14.🌈 Which colour of light is strongest in rgb(107, 29, 222)? (a) red (b) green (c) blue
  15. 15.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  16. 16.🌈 Which colour is #00ffff? (a) black (b) cyan (c) magenta (d) blue
  17. 17.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-start (c) space-between (d) flex-end
  18. 18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 5px;
      border: 4px solid black;
      margin: 20px;
    }
  19. 19.Which of these is the border? (a) space outside the border (b) the gap round content (c) the text or picture (d) a solid or dotted edge
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  21. 21.True or false: li is an element selector. (a) False (b) True
  22. 22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  23. 23.✍️ Which property is set to 10px in this rule?
    h2 {
      font-style: italic;
      background-color: yellow;
      margin: 10px;
      text-align: center;
    }
    (a) font-weight (b) padding (c) 10px (d) margin
  24. 24.True or false: #hero is an id selector. (a) True (b) False
  25. 25.🖌️ Which CSS property centres a heading? (a) color (b) font-weight (c) text-align (d) background-color
  26. 26.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  27. 27.What does font-size do? (a) picks the font style (b) sets the letter colour (c) makes the text bold (d) makes letters bigger
  28. 28.🎯 How many elements on a page should have the same id? (a) any number (b) 5 (c) 1 (d) 2
  29. 29.✍️ In color: blue; which part is the property? (a) color (b) blue (c) ; (d) :
  30. 30.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) J (c) G (d) F
  31. 31.🌈 Which hex code is cyan? (a) #00ff00 (b) #ffffff (c) #0000ff (d) #00ffff
  32. 32.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  33. 33.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      color: black;
      background-color: yellow;
      font-size: 28px;
    }
    (a) black (b) blue (c) yellow
  34. 34.🌈 Which hex code is black? (a) #000000 (b) #ffff00 (c) #ff00ff (d) #0000ff
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    h2 { color: black; }
    .big { color: green; }
    #end { color: orange; }
    (a) green (b) black (c) purple (d) orange
  36. 36.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) gap (c) align-items (d) justify-content
  37. 37.💪 Which flexbox property sets space between boxes? (a) gap (b) flex-direction (c) align-items (d) display: flex
  38. 38.✍️ What value is given to text-align in this rule?
    .note {
      text-align: center;
      width: 300px;
    }
    (a) yellow (b) text-align (c) center (d) 10px
  39. 39.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) space-between (d) center
  40. 40.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      font-weight: bold;
      color: red;
    }
    (a) padding (b) bold (c) #top (d) .note

Answer key

  1. 242
  2. 600px or narrower
  3. lays out the page
  4. Yes
  5. fits every screen
  6. /*
  7. background-color
  8. 20
  9. .box
  10. flex-end
  11. 255
  12. p
  13. yellow
  14. blue
  15. the later one
  16. cyan
  17. center
  18. 298
  19. a solid or dotted edge
  20. 70
  21. True
  22. 12
  23. margin
  24. True
  25. text-align
  26. No
  27. makes letters bigger
  28. 1
  29. color
  30. F
  31. #00ffff
  32. red
  33. black
  34. #000000
  35. orange
  36. justify-content
  37. gap
  38. center
  39. space-between
  40. .note

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