← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 751 · 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.True or false: margin is space outside the border. (a) False (b) True
  2. 2.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  4. 4.🔍 Which is the odd one out? (a) makes a form box (b) puts a picture on a page (c) checks a quiz answer (d) gives the page structure
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    h1 { color: red; }
    .box { color: black; }
    #intro { color: yellow; }
    (a) red (b) black (c) blue (d) yellow
  6. 6.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
  7. 7.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    p { color: black; }
    p { color: orange; }
    (a) black (b) green (c) blue (d) orange
  8. 8.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      color: black;
      font-size: 32px;
      background-color: green;
    }
    (a) black (b) orange (c) green
  9. 9.Which of these does CSS do? (a) makes a form box (b) makes headings and lists (c) makes a link (d) lays out the page
  10. 10.📦 In the box model, which part is the gap round content? (a) border (b) content (c) padding (d) margin
  11. 11.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) never changes (d) is only for laptops
  12. 12.🌈 Which colour is rgb(255, 255, 0)? (a) red (b) white (c) yellow (d) bright green
  13. 13.✍️ What is the selector in this CSS rule?
    h2 {
      padding: 8px;
      width: 300px;
      text-align: center;
      border: 2px solid;
    }
    (a) padding (b) h1 (c) 300px (d) h2
  14. 14.📱 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;
      }
    }
  15. 15.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  16. 16.🎯 Which sign starts an id selector? (a) . (b) & (c) @ (d) #
  17. 17.💪 Which flexbox property lines boxes up across? (a) gap (b) justify-content (c) flex-direction (d) align-items
  18. 18.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) justify-content (c) display: flex (d) gap
  19. 19.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  20. 20.🌈 Which colour of light is strongest in rgb(90, 229, 88)? (a) green (b) red (c) blue
  21. 21.✍️ Which property is set to bold in this rule?
    .note {
      font-weight: bold;
      font-style: italic;
    }
    (a) border (b) font-weight (c) width (d) bold
  22. 22.📱 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;
      }
    }
  23. 23.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  24. 24.What does font-size do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
  25. 25.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  26. 26.✍️ Which property is set to yellow in this rule?
    p {
      background-color: yellow;
      padding: 8px;
      color: red;
    }
    (a) yellow (b) background-color (c) padding (d) margin
  27. 27.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  28. 28.✍️ What value is given to padding in this rule?
    h2 {
      padding: 8px;
      font-style: italic;
      border: 2px solid;
    }
    (a) 8px (b) bold (c) padding (d) 2px solid
  29. 29.🖌️ How big is the text, in px?
    h1 {
      color: white;
      background-color: blue;
      font-size: 36px;
      text-align: right;
    }
  30. 30.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  31. 31.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
  32. 32.✍️ What value is given to padding in this rule?
    #top {
      padding: 8px;
      width: 300px;
    }
    (a) 2px solid (b) padding (c) bold (d) 8px
  33. 33.🎯 Which CSS selector matches this element?
    <div class="note" id="hero">Hello</div>
    (a) span (b) div (c) #note (d) #top
  34. 34.True or false: JavaScript reacts to a button click. (a) False (b) True
  35. 35.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
  36. 36.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
  37. 37.🎯 Which element does the selector .star style? (a) <p class="star"> (b) <h1 class="note"> (c) <p class="menu"> (d) <p id="star">
  38. 38.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
  39. 39.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) Z (c) J (d) G
  40. 40.Which of these does CSS do? (a) counts down a timer (b) adds space around boxes (c) makes a form box (d) changes the page live

Answer key

  1. True
  2. flex-start
  3. 30
  4. checks a quiz answer
  5. yellow
  6. CSS
  7. orange
  8. green
  9. lays out the page
  10. padding
  11. fits every screen
  12. yellow
  13. h2
  14. 8
  15. 20
  16. #
  17. align-items
  18. gap
  19. 12
  20. green
  21. font-weight
  22. 12
  23. the later one
  24. makes letters bigger
  25. No
  26. background-color
  27. Yes
  28. 8px
  29. 36
  30. an element selector
  31. .
  32. 8px
  33. div
  34. True
  35. blue
  36. :
  37. <p class="star">
  38. the viewport meta tag
  39. F
  40. adds space around boxes

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