← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 759 · 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.🖌️ Where does the text sit on its line?
    li {
      color: orange;
      background-color: white;
      font-size: 32px;
      text-align: center;
    }
    (a) on the right (b) on the left (c) in the middle
  2. 2.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
  3. 3.✍️ Which property is set to 20px in this rule?
    body {
      color: red;
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
    (a) font-size (b) background-color (c) 20px (d) text-align
  4. 4.🌈 Which colour of light is strongest in rgb(153, 10, 81)? (a) green (b) blue (c) red
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  6. 6.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  7. 7.🎯 Which sign starts an id selector? (a) @ (b) . (c) # (d) &
  8. 8.🌈 Which colour is #000000? (a) red (b) bright green (c) yellow (d) black
  9. 9.True or false: the border is the gap to other boxes. (a) True (b) False
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    #top { color: red; }
    #top { color: blue; }
    (a) red (b) blue (c) orange (d) green
  11. 11.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
  12. 12.✍️ Which property is set to bold in this rule?
    h2 {
      font-weight: bold;
      border: 2px solid;
    }
    (a) width (b) bold (c) font-weight (d) border
  13. 13.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  14. 14.🎯 Can many elements share the same class? (a) Yes (b) No
  15. 15.True or false: CSS rounds box corners. (a) True (b) False
  16. 16.📦 In the box model, which part is space outside the border? (a) content (b) padding (c) margin (d) border
  17. 17.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
  18. 18.🌈 Which colour is #00ff00? (a) yellow (b) bright green (c) blue (d) black
  19. 19.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) color (d) :
  20. 20.True or false: #end is a class selector. (a) True (b) False
  21. 21.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 90px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  23. 23.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 100 (d) 1000
  24. 24.🔍 Which is the odd one out? (a) makes headings and lists (b) reacts to a button click (c) shows a pop-up message (d) counts down a timer
  25. 25.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      text-align: center;
      font-style: italic;
    }
  27. 27.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  28. 28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 160px;
      padding: 15px;
      border: 4px solid black;
      margin: 0px;
    }
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: orange; }
    h1 { color: green; }
    (a) orange (b) purple (c) green (d) white
  30. 30.What does background-color do? (a) picks the font style (b) makes letters bigger (c) colours behind the text (d) centres a heading
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      margin: 10px;
      text-align: center;
    }
  32. 32.🎯 Which element does the selector #intro style? (a) <h1 class="intro"> (b) <h1 id="intro"> (c) <h2 class="big"> (d) <h1 id="main">
  33. 33.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  34. 34.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
  35. 35.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  36. 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
  37. 37.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  38. 38.🎯 Which CSS selector matches this element?
    <h2 class="red" id="end">Hello</h2>
    (a) #hero (b) #end (c) .box (d) .end
  39. 39.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).

Answer key

  1. in the middle
  2. CSS
  3. font-size
  4. red
  5. 20
  6. 14
  7. #
  8. black
  9. False
  10. blue
  11. F
  12. font-weight
  13. No
  14. Yes
  15. True
  16. margin
  17. 24
  18. bright green
  19. color
  20. False
  21. 10
  22. 20
  23. 255
  24. makes headings and lists
  25. .
  26. 3
  27. Yes
  28. 198
  29. orange
  30. colours behind the text
  31. 2
  32. <h1 id="intro">
  33. 12
  34. 32
  35. No
  36. 800px or wider
  37. 40
  38. #end
  39. No
  40. 30

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