← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 49 · 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 sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
  2. 2.🌈 Which colour is #ffffff? (a) white (b) yellow (c) black (d) cyan
  3. 3.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  4. 4.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector
  5. 5.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  6. 6.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      font-style: italic;
    }
    (a) h1 (b) color (c) italic (d) p
  7. 7.💪 Which flexbox property sets space between boxes? (a) display: flex (b) gap (c) align-items (d) flex-direction
  8. 8.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  9. 9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  10. 10.🖌️ How big is the text, in px?
    li {
      font-size: 36px;
      color: green;
      text-align: right;
      background-color: yellow;
    }
  11. 11.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  12. 12.✍️ What is the selector in this CSS rule?
    .box {
      border: 2px solid;
      color: red;
      background-color: yellow;
    }
    (a) red (b) border (c) h2 (d) .box
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  14. 14.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  15. 15.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    .red { color: black; }
    .red { color: green; }
    (a) green (b) yellow (c) white (d) black
  17. 17.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  18. 18.🖌️ Which CSS property colours behind the text? (a) font-weight (b) color (c) font-family (d) background-color
  19. 19.🌈 Which colour is #ff0000? (a) red (b) white (c) blue (d) bright green
  20. 20.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
  21. 21.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 100px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: black; }
    (a) red (b) yellow (c) black (d) green
  23. 23.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
  24. 24.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  25. 25.🎯 Which CSS selector matches this element?
    <div class="box" id="main">Hello</div>
    (a) .main (b) .box (c) #box (d) span
  26. 26.True or false: HTML puts a picture on a page. (a) True (b) False
  27. 27.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
  28. 28.🌈 Which colour of light is strongest in rgb(123, 124, 179)? (a) blue (b) red (c) green
  29. 29.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      margin: 10px;
      width: 300px;
      font-size: 20px;
      font-weight: bold;
    }
  31. 31.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="red" id="main">Hi</h2>
    CSS:
    #main { color: orange; }
    .red { color: green; }
    h2 { color: purple; }
    (a) orange (b) yellow (c) purple (d) green
  33. 33.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  34. 34.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  35. 35.True or false: CSS makes headings and lists. (a) True (b) False
  36. 36.🌈 In #00de00 the green part is the hex number de. What is it as a normal number?
  37. 37.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
  38. 38.🌈 Which colour is rgb(0, 0, 0)? (a) cyan (b) yellow (c) black (d) blue
  39. 39.🌈 Which colour of light is strongest in rgb(203, 106, 8)? (a) blue (b) red (c) green
  40. 40.✍️ Which property is set to bold in this rule?
    li {
      font-style: italic;
      font-weight: bold;
    }
    (a) font-weight (b) border (c) width (d) bold

Answer key

  1. ;
  2. white
  3. No
  4. an id selector
  5. Yes
  6. h1
  7. gap
  8. 10
  9. 24
  10. 36
  11. 16
  12. .box
  13. 80
  14. equal gaps, none at ends
  15. HTML
  16. green
  17. an element selector
  18. background-color
  19. red
  20. blue
  21. 20
  22. black
  23. flex-direction
  24. 178
  25. .box
  26. True
  27. /*
  28. blue
  29. No
  30. 4
  31. Cascading Style Sheets
  32. orange
  33. Yes
  34. puts boxes in the middle
  35. False
  36. 222
  37. 600px or narrower
  38. black
  39. red
  40. font-weight

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