← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 510 · 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.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
  2. 2.✍️ What value is given to width in this rule?
    .note {
      font-style: italic;
      border: 2px solid;
      width: 300px;
      padding: 8px;
    }
    (a) red (b) italic (c) width (d) 300px
  3. 3.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
  4. 4.🖌️ What colour are the letters?
    li {
      font-size: 28px;
      color: orange;
      text-align: right;
      background-color: green;
    }
    (a) orange (b) yellow (c) green
  5. 5.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  6. 6.Which of these does HTML do? (a) adds space around boxes (b) makes headings and lists (c) counts down a timer (d) rounds box corners
  7. 7.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      font-style: italic;
      text-align: center;
    }
  9. 9.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-start (d) flex-end
  10. 10.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  11. 11.True or false: .big is a class selector. (a) False (b) True
  12. 12.True or false: .menu is a class selector. (a) True (b) False
  13. 13.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  14. 14.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  15. 15.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  16. 16.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 5px;
      border: 2px solid black;
      margin: 20px;
    }
  18. 18.True or false: HTML adds space around boxes. (a) False (b) True
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  20. 20.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  21. 21.🖌️ What colour are the letters?
    h1 {
      background-color: red;
      font-size: 24px;
      text-align: center;
      color: purple;
    }
    (a) purple (b) red (c) blue
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  23. 23.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) font-size (d) background-color
  24. 24.✍️ Which property is set to red in this rule?
    h1 {
      color: red;
      border: 2px solid;
      width: 300px;
      background-color: yellow;
    }
    (a) text-align (b) font-size (c) color (d) red
  25. 25.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 12px;
      text-align: center;
      color: green;
      background-color: blue;
    }
    (a) on the left (b) on the right (c) in the middle
  26. 26.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  27. 27.True or false: HTML checks a quiz answer. (a) False (b) True
  28. 28.✍️ What is the selector in this CSS rule?
    h2 {
      padding: 8px;
      text-align: center;
      margin: 10px;
      font-style: italic;
    }
    (a) padding (b) h2 (c) center (d) h1
  29. 29.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .html (d) .png
  30. 30.✍️ What is the selector in this CSS rule?
    .box {
      margin: 10px;
      color: red;
    }
    (a) margin (b) h2 (c) red (d) .box
  31. 31.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: green; }
    .note { color: red; }
    (a) blue (b) red (c) green (d) orange
  32. 32.What does text-align do? (a) colours behind the text (b) makes letters bigger (c) centres a heading (d) sets the letter colour
  33. 33.🎯 Which CSS selector matches this element?
    <p class="red" id="hero">Hello</p>
    (a) h1 (b) .hero (c) p (d) #red
  34. 34.🌈 Which colour is #000000? (a) cyan (b) bright green (c) black (d) blue
  35. 35.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      color: green;
      background-color: orange;
      font-size: 12px;
    }
    (a) blue (b) green (c) orange
  36. 36.🌈 Which hex code is black? (a) #000000 (b) #ffffff (c) #0000ff (d) #00ff00
  37. 37.True or false: the border is space inside the border. (a) True (b) False
  38. 38.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      border: 2px solid;
      margin: 10px;
    }
  40. 40.✍️ What value is given to text-align in this rule?
    p {
      font-size: 20px;
      text-align: center;
      background-color: yellow;
      color: red;
    }
    (a) 10px (b) yellow (c) center (d) text-align

Answer key

  1. 600px or narrower
  2. 300px
  3. 800px or wider
  4. orange
  5. Yes
  6. makes headings and lists
  7. a class selector
  8. 3
  9. flex-start
  10. an id selector
  11. True
  12. True
  13. 28
  14. equal gaps, none at ends
  15. 20
  16. :
  17. 344
  18. False
  19. 50
  20. HTML
  21. purple
  22. 30
  23. background-color
  24. color
  25. in the middle
  26. an element selector
  27. False
  28. h2
  29. .css
  30. .box
  31. green
  32. centres a heading
  33. p
  34. black
  35. orange
  36. #000000
  37. False
  38. blue
  39. 2
  40. center

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