← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 352 · 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. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  2. 2.True or false: .big is an id selector. (a) True (b) False
  3. 3.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  4. 4.🔍 Which is the odd one out? (a) adds space around boxes (b) makes a link (c) puts a picture on a page (d) gives the page structure
  5. 5.📦 In the box model, which part is the text or picture? (a) margin (b) padding (c) border (d) content
  6. 6.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  7. 7.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  8. 8.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 12px;
      background-color: yellow;
      text-align: right;
      color: purple;
    }
    (a) on the left (b) on the right (c) in the middle
  9. 9.🖌️ What colour is behind the letters?
    li {
      background-color: white;
      font-size: 20px;
      text-align: center;
      color: purple;
    }
    (a) blue (b) purple (c) white
  10. 10.🌈 In #005600 the green part is the hex number 56. What is it as a normal number?
  11. 11.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    .star { color: white; }
    .star { color: purple; }
    (a) white (b) orange (c) purple (d) black
  12. 12.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-end (c) space-between (d) flex-start
  13. 13.💪 Which flexbox property lines boxes up across? (a) align-items (b) flex-direction (c) justify-content (d) gap
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 15px;
      border: 4px solid black;
      margin: 5px;
    }
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: red; }
    (a) black (b) red (c) green (d) orange
  16. 16.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
  17. 17.Which of these does CSS do? (a) lays out the page (b) counts down a timer (c) checks a quiz answer (d) shows a pop-up message
  18. 18.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) changes the text size (d) counts down a timer
  19. 19.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) red (d) black
  20. 20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  21. 21.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  22. 22.True or false: JavaScript changes the page live. (a) False (b) True
  23. 23.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  24. 24.🔍 Which is the odd one out? (a) shows a pop-up message (b) lays out the page (c) adds space around boxes (d) rounds box corners
  25. 25.🎯 Which CSS selector matches this element?
    <h1 class="star" id="intro">Hello</h1>
    (a) #main (b) .intro (c) .star (d) #star
  26. 26.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    .note { color: green; }
    p { color: red; }
    #top { color: white; }
    (a) yellow (b) white (c) green (d) red
  27. 27.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  28. 28.🎯 Can many elements share the same class? (a) Yes (b) No
  29. 29.🎯 Which CSS selector matches this element?
    <li class="menu" id="intro">Hello</li>
    (a) #main (b) li (c) .note (d) #menu
  30. 30.⚖️ What colour is the text of this element?
    <h2 class="menu" id="intro">Hi</h2>
    CSS:
    #intro { color: blue; }
    .menu { color: white; }
    h2 { color: red; }
    (a) blue (b) red (c) white (d) black
  31. 31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  32. 32.💪 Which flexbox property turns on flexbox? (a) gap (b) justify-content (c) display: flex (d) align-items
  33. 33.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) , (d) :
  34. 34.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) blue (d) green
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-size: 20px;
      background-color: yellow;
      border: 2px solid;
      color: red;
    }
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  37. 37.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    p { color: orange; }
    p { color: green; }
    (a) yellow (b) orange (c) green (d) blue
  38. 38.🎯 Which CSS selector matches this element?
    <li class="red" id="logo">Hello</li>
    (a) .logo (b) #end (c) #logo (d) #red
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 350px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  40. 40.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }

Answer key

  1. No
  2. False
  3. equal gaps, none at ends
  4. adds space around boxes
  5. content
  6. No
  7. 12
  8. on the right
  9. white
  10. 86
  11. purple
  12. flex-end
  13. align-items
  14. 108
  15. red
  16. HTML
  17. lays out the page
  18. counts down a timer
  19. red
  20. 288
  21. packs boxes at the start
  22. True
  23. an element selector
  24. shows a pop-up message
  25. .star
  26. white
  27. No
  28. Yes
  29. li
  30. blue
  31. 24
  32. display: flex
  33. ;
  34. blue
  35. 4
  36. 20
  37. green
  38. #logo
  39. 50
  40. 20

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