← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 264 · 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.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  2. 2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  3. 3.Which of these does HTML do? (a) changes the page live (b) changes the text size (c) checks a quiz answer (d) makes a form box
  4. 4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
  5. 5.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      text-align: center;
      font-style: italic;
    }
    (a) .note (b) center (c) p (d) color
  6. 6.✍️ In color: blue; which part is the value? (a) blue (b) color (c) ; (d) :
  7. 7.🔍 Which is the odd one out? (a) checks a quiz answer (b) gives the page structure (c) changes the page live (d) counts down a timer
  8. 8.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
  9. 9.🖌️ How big is the text, in px?
    h1 {
      font-size: 20px;
      text-align: center;
      color: white;
      background-color: yellow;
    }
  10. 10.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      font-size: 20px;
      color: yellow;
      background-color: black;
    }
    (a) yellow (b) black (c) white
  11. 11.True or false: JavaScript counts down a timer. (a) False (b) True
  12. 12.🌈 Which colour of light is strongest in rgb(224, 107, 118)? (a) red (b) blue (c) green
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      text-align: center;
      border: 2px solid;
      color: red;
    }
  14. 14.Which of these does CSS do? (a) adds space around boxes (b) changes the page live (c) makes a form box (d) puts a picture on a page
  15. 15.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  16. 16.🖌️ Which CSS property centres a heading? (a) text-align (b) font-family (c) font-weight (d) font-size
  17. 17.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) sets colours and fonts (d) puts a picture on a page
  18. 18.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
  19. 19.True or false: #logo is an id selector. (a) False (b) True
  20. 20.🎯 Which CSS selector matches this element?
    <li class="menu" id="hero">Hello</li>
    (a) div (b) #menu (c) #hero (d) .note
  21. 21.🌈 Which colour is #ff0000? (a) black (b) yellow (c) red (d) bright green
  22. 22.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
  23. 23.True or false: HTML makes headings and lists. (a) False (b) True
  24. 24.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      color: red;
      font-style: italic;
      border: 2px solid;
    }
    (a) red (b) .note (c) font-size (d) p
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 25px;
      border: 5px solid black;
      margin: 20px;
    }
  26. 26.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  27. 27.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) padding (d) content
  28. 28.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
  29. 29.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) cyan (c) yellow (d) black
  30. 30.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      margin: 10px;
    }
    (a) 10px (b) color (c) .note (d) p
  31. 31.✍️ Which property is set to 10px in this rule?
    #top {
      margin: 10px;
      font-weight: bold;
    }
    (a) margin (b) font-weight (c) 10px (d) padding
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 130px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  34. 34.📱 The screen is 320px 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 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  36. 36.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: blue; }
    h2 { color: orange; }
    (a) white (b) orange (c) blue (d) red
  38. 38.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) flex-direction (d) justify-content
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
      color: red;
    }
  40. 40.🎯 Which element does the selector div style? (a) <span> (b) <h1 id="top"> (c) <div class="note"> (d) <p class="note">

Answer key

  1. equal gaps, none at ends
  2. 26
  3. makes a form box
  4. 24
  5. p
  6. blue
  7. gives the page structure
  8. flex-start
  9. 20
  10. yellow
  11. True
  12. red
  13. 3
  14. adds space around boxes
  15. an element selector
  16. text-align
  17. puts a picture on a page
  18. JavaScript
  19. True
  20. #hero
  21. red
  22. F
  23. True
  24. p
  25. 140
  26. an id selector
  27. margin
  28. JavaScript
  29. bright green
  30. p
  31. margin
  32. 10
  33. 50
  34. 24
  35. Yes
  36. 18
  37. blue
  38. display: flex
  39. 2
  40. <div class="note">

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