← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 491 · 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) center (d) flex-end
  2. 2.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  3. 3.💪 Which flexbox property turns on flexbox? (a) align-items (b) flex-direction (c) gap (d) display: flex
  4. 4.✍️ What value is given to width in this rule?
    .note {
      margin: 10px;
      background-color: yellow;
      width: 300px;
    }
    (a) red (b) width (c) italic (d) 300px
  5. 5.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      background-color: white;
      color: yellow;
      font-size: 24px;
    }
    (a) purple (b) yellow (c) white
  6. 6.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  7. 7.🖌️ What colour are the letters?
    h1 {
      font-size: 40px;
      color: white;
      background-color: yellow;
      text-align: right;
    }
    (a) red (b) yellow (c) white
  8. 8.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 6 (d) 4
  9. 9.💪 Which flexbox property lines boxes up across? (a) align-items (b) flex-direction (c) gap (d) display: flex
  10. 10.✍️ In color: blue; which part is the value? (a) color (b) blue (c) : (d) ;
  11. 11.🌈 Which hex code is yellow? (a) #000000 (b) #00ffff (c) #ffff00 (d) #ff00ff
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    .big { color: red; }
    h1 { color: white; }
    (a) yellow (b) white (c) green (d) red
  13. 13.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
  14. 14.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) black (c) bright green (d) yellow
  15. 15.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  17. 17.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  18. 18.🖌️ Which CSS property sets the letter colour? (a) font-family (b) color (c) text-align (d) font-size
  19. 19.✍️ What value is given to color in this rule?
    h1 {
      margin: 10px;
      color: red;
    }
    (a) color (b) red (c) 20px (d) center
  20. 20.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) , (d) ;
  21. 21.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  22. 22.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  23. 23.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  24. 24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 15px;
      border: 3px solid black;
      margin: 15px;
    }
  25. 25.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  26. 26.🌈 Which colour of light is strongest in rgb(64, 168, 117)? (a) red (b) blue (c) green
  27. 27.🌈 Which colour of light is strongest in rgb(131, 129, 203)? (a) red (b) green (c) blue
  28. 28.🎯 Which CSS selector matches this element?
    <li class="red" id="main">Hello</li>
    (a) .box (b) div (c) #red (d) .red
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 20px;
      border: 5px solid black;
      margin: 5px;
    }
  30. 30.🌈 Which hex code is blue? (a) #0000ff (b) #ff00ff (c) #ff0000 (d) #00ffff
  31. 31.💪 Which justify-content value equal gaps, none at ends? (a) center (b) space-between (c) flex-end (d) flex-start
  32. 32.🖌️ How big is the text, in px?
    h1 {
      color: blue;
      font-size: 12px;
      background-color: black;
      text-align: left;
    }
  33. 33.True or false: margin is space inside the border. (a) True (b) False
  34. 34.🌈 Which colour of light is strongest in rgb(75, 227, 72)? (a) red (b) blue (c) green
  35. 35.What does font-family do? (a) centres a heading (b) colours behind the text (c) picks the font style (d) sets the letter colour
  36. 36.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
  37. 37.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      margin: 10px;
      font-weight: bold;
    }
    (a) 10px (b) border (c) h1 (d) h2
  38. 38.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-family (c) background-color (d) font-weight
  39. 39.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  40. 40.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5

Answer key

  1. center
  2. :
  3. display: flex
  4. 300px
  5. yellow
  6. Yes
  7. white
  8. 3
  9. align-items
  10. blue
  11. #ffff00
  12. red
  13. a class selector
  14. bright green
  15. a class selector
  16. 30
  17. 20
  18. color
  19. red
  20. ;
  21. 22
  22. No
  23. Yes
  24. 86
  25. HTML
  26. green
  27. blue
  28. .red
  29. 120
  30. #0000ff
  31. space-between
  32. 12
  33. False
  34. green
  35. picks the font style
  36. /*
  37. h2
  38. background-color
  39. Yes
  40. 1

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