← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 35 · 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 of these does HTML do? (a) checks a quiz answer (b) gives the page structure (c) adds space around boxes (d) changes the text size
  2. 2.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      padding: 8px;
      color: red;
      background-color: yellow;
    }
  4. 4.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
  5. 5.💪 Which flexbox property turns on flexbox? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
  6. 6.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  7. 7.🎯 Which element does the selector #end style? (a) <li id="end"> (b) <li class="end"> (c) <li id="hero"> (d) <div class="star">
  8. 8.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  9. 9.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="star" id="logo">Hi</h2>
    CSS:
    h2 { color: purple; }
    .star { color: orange; }
    #logo { color: blue; }
    (a) blue (b) yellow (c) purple (d) orange
  11. 11.🌈 In #ce0000 the red part is the hex number ce. What is it as a normal number?
  12. 12.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  13. 13.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  14. 14.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  15. 15.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
  16. 16.True or false: margin is the line round the box. (a) False (b) True
  17. 17.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 20px;
      border: 4px solid black;
      margin: 20px;
    }
  18. 18.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
  19. 19.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: green; }
    (a) blue (b) orange (c) purple (d) green
  20. 20.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  21. 21.🎯 What kind of selector is li? (a) an element selector (b) an id selector (c) a class selector
  22. 22.💪 Which flexbox property picks row or column? (a) align-items (b) gap (c) display: flex (d) flex-direction
  23. 23.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) blue (c) green (d) red
  24. 24.Which of these does CSS do? (a) makes a link (b) reacts to a button click (c) makes headings and lists (d) lays out the page
  25. 25.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
  26. 26.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
      font-size: 20px;
      padding: 8px;
      font-weight: bold;
    }
  28. 28.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) space-between (d) center
  29. 29.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-size (d) background-color
  30. 30.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
  31. 31.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  32. 32.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  34. 34.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  35. 35.True or false: HTML gives the page structure. (a) True (b) False
  36. 36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  37. 37.True or false: HTML makes a form box. (a) True (b) False
  38. 38.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  39. 39.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  40. 40.True or false: #logo is an element selector. (a) False (b) True

Answer key

  1. gives the page structure
  2. 8
  3. 3
  4. the screen width
  5. display: flex
  6. No
  7. <li id="end">
  8. center
  9. blue
  10. blue
  11. 206
  12. packs boxes at the start
  13. 12
  14. an element selector
  15. an element selector
  16. False
  17. 208
  18. the later one
  19. green
  20. 16
  21. an element selector
  22. flex-direction
  23. red
  24. lays out the page
  25. align-items
  26. Yes
  27. 4
  28. flex-start
  29. font-size
  30. { }
  31. Yes
  32. flex-end
  33. 70
  34. 50
  35. True
  36. 18
  37. True
  38. an id selector
  39. No
  40. False

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