← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 530 · 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.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  2. 2.💪 Which flexbox property lines boxes up across? (a) display: flex (b) gap (c) justify-content (d) align-items
  3. 3.🧩 Which language changes the page live? (a) HTML (b) JavaScript (c) CSS
  4. 4.True or false: the border is the line round the box. (a) True (b) False
  5. 5.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) 800px or narrower (d) turned off
  6. 6.True or false: JavaScript counts down a timer. (a) False (b) True
  7. 7.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) space-between (d) center
  8. 8.🌈 Which colour is #ffff00? (a) black (b) white (c) magenta (d) yellow
  9. 9.Which of these does HTML do? (a) puts a picture on a page (b) adds space around boxes (c) changes the text size (d) reacts to a button click
  10. 10.True or false: CSS changes the page live. (a) False (b) True
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  12. 12.✍️ What is the selector in this CSS rule?
    li {
      font-weight: bold;
      padding: 8px;
      width: 300px;
    }
    (a) body (b) 8px (c) font-weight (d) li
  13. 13.🖌️ Which CSS property centres a heading? (a) text-align (b) font-weight (c) font-size (d) color
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    h1 { color: black; }
    #logo { color: red; }
    .menu { color: orange; }
    (a) black (b) red (c) orange (d) green
  15. 15.True or false: li is a class selector. (a) False (b) True
  16. 16.✍️ What is the selector in this CSS rule?
    body {
      color: red;
      padding: 8px;
      margin: 10px;
    }
    (a) 8px (b) color (c) body (d) .box
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  18. 18.True or false: padding is a solid or dotted edge. (a) True (b) False
  19. 19.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  20. 20.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
  21. 21.Which of these does JavaScript do? (a) rounds box corners (b) checks a quiz answer (c) makes headings and lists (d) adds space around boxes
  22. 22.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  23. 23.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
      color: red;
      width: 300px;
    }
  25. 25.🎯 Which element does the selector .red style? (a) <li class="box"> (b) <li id="red"> (c) <li class="red"> (d) <div class="star">
  26. 26.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) turned off (d) exactly 1000px
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  28. 28.🌈 Which colour of light is strongest in rgb(255, 118, 15)? (a) green (b) red (c) blue
  29. 29.🖌️ What colour is behind the letters?
    li {
      color: orange;
      background-color: yellow;
      text-align: right;
      font-size: 16px;
    }
    (a) orange (b) yellow (c) red
  30. 30.🎯 Which CSS selector matches this element?
    <h1 class="big" id="logo">Hello</h1>
    (a) #big (b) .logo (c) h2 (d) h1
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 420px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  32. 32.🎯 Which element does the selector div style? (a) <span> (b) <p class="red"> (c) <h1 id="end"> (d) <div class="red">
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  34. 34.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  35. 35.🌈 In #8a0000 the red part is the hex number 8a. What is it as a normal number?
  36. 36.🧩 Which language shows a pop-up message? (a) HTML (b) CSS (c) JavaScript
  37. 37.🎯 Which element does the selector .star style? (a) <h1 class="star"> (b) <h1 class="menu"> (c) <h2 class="note"> (d) <h1 id="star">
  38. 38.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) color (d) font-family
  39. 39.Which of these does HTML do? (a) counts down a timer (b) sets colours and fonts (c) makes headings and lists (d) changes the text size
  40. 40.True or false: .big is a class selector. (a) False (b) True

Answer key

  1. 14
  2. align-items
  3. JavaScript
  4. True
  5. 800px or wider
  6. True
  7. flex-end
  8. yellow
  9. puts a picture on a page
  10. False
  11. 228
  12. li
  13. text-align
  14. red
  15. False
  16. body
  17. 80
  18. False
  19. an element selector
  20. red
  21. checks a quiz answer
  22. Yes
  23. 16
  24. 3
  25. <li class="red">
  26. 600px or narrower
  27. 60
  28. red
  29. yellow
  30. h1
  31. 20
  32. <div class="red">
  33. 10
  34. Yes
  35. 138
  36. JavaScript
  37. <h1 class="star">
  38. color
  39. makes headings and lists
  40. True

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