← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 290 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 25px;
      border: 2px solid black;
      margin: 15px;
    }
  2. 2.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  4. 4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 30px;
      border: 3px solid black;
      margin: 20px;
    }
  5. 5.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) red (c) white (d) green
  6. 6.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector
  7. 7.✍️ What value is given to margin in this rule?
    h2 {
      margin: 10px;
      font-size: 20px;
    }
    (a) 8px (b) 10px (c) bold (d) margin
  8. 8.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) space-between (d) flex-start
  9. 9.🔍 Which is the odd one out? (a) rounds box corners (b) puts a picture on a page (c) adds space around boxes (d) sets colours and fonts
  10. 10.True or false: CSS adds space around boxes. (a) True (b) False
  11. 11.🎯 Which CSS selector matches this element?
    <li class="star" id="main">Hello</li>
    (a) .menu (b) .main (c) div (d) li
  12. 12.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) fits every screen (d) never changes
  13. 13.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-end (c) center (d) flex-start
  14. 14.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  15. 15.Which of these does JavaScript do? (a) rounds box corners (b) puts a picture on a page (c) makes a form box (d) counts down a timer
  16. 16.Which of these does CSS do? (a) counts down a timer (b) puts a picture on a page (c) makes a form box (d) lays out the page
  17. 17.Which of these is padding? (a) a solid or dotted edge (b) the line round the box (c) the gap to other boxes (d) the gap round content
  18. 18.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 460px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  19. 19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  20. 20.True or false: padding is space inside the border. (a) False (b) True
  21. 21.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  22. 22.🌈 Which hex code is red? (a) #0000ff (b) #ff0000 (c) #000000 (d) #00ff00
  23. 23.Which of these does HTML do? (a) counts down a timer (b) adds space around boxes (c) checks a quiz answer (d) makes headings and lists
  24. 24.🎯 Which element does the selector #top style? (a) <span id="top"> (b) <span class="top"> (c) <span id="intro"> (d) <p class="red">
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    h1 { color: white; }
    .note { color: blue; }
    (a) white (b) yellow (c) red (d) blue
  27. 27.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes a form box (d) changes the text size
  28. 28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  29. 29.🖌️ How big is the text, in px?
    p {
      text-align: center;
      background-color: blue;
      font-size: 36px;
      color: red;
    }
  30. 30.📦 In the box model, which part is space outside the border? (a) margin (b) border (c) content (d) padding
  31. 31.🎯 Which element does the selector #hero style? (a) <p class="hero"> (b) <h1 class="star"> (c) <p id="top"> (d) <p id="hero">
  32. 32.🎯 Can many elements share the same class? (a) No (b) Yes
  33. 33.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-weight (c) color (d) font-size
  34. 34.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: orange; }
    (a) white (b) black (c) orange (d) yellow
  36. 36.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 90px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  38. 38.True or false: HTML sets colours and fonts. (a) True (b) False
  39. 39.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
  40. 40.✍️ Which property is set to 10px in this rule?
    h1 {
      margin: 10px;
      background-color: yellow;
      font-style: italic;
    }
    (a) padding (b) 10px (c) margin (d) font-weight

Answer key

  1. 314
  2. equal gaps, none at ends
  3. 50
  4. 166
  5. blue
  6. a class selector
  7. 10px
  8. center
  9. puts a picture on a page
  10. True
  11. li
  12. fits every screen
  13. flex-start
  14. Yes
  15. counts down a timer
  16. lays out the page
  17. the gap round content
  18. 20
  19. 16
  20. True
  21. HTML
  22. #ff0000
  23. makes headings and lists
  24. <span id="top">
  25. 20
  26. blue
  27. changes the text size
  28. 24
  29. 36
  30. margin
  31. <p id="hero">
  32. Yes
  33. font-size
  34. No
  35. orange
  36. an id selector
  37. 10
  38. False
  39. an id selector
  40. margin

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