← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 404 · 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. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  2. 2.🎯 Which CSS selector matches this element?
    <span class="big" id="hero">Hello</span>
    (a) .red (b) #big (c) #top (d) .big
  3. 3.What does font-weight do? (a) makes the text bold (b) makes letters bigger (c) centres a heading (d) sets the letter colour
  4. 4.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-family (c) color (d) background-color
  5. 5.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 20px;
      background-color: blue;
      text-align: left;
      color: yellow;
    }
    (a) on the right (b) in the middle (c) on the left
  6. 6.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  7. 7.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  8. 8.True or false: HTML adds space around boxes. (a) True (b) False
  9. 9.💪 Which flexbox property lines boxes up across? (a) display: flex (b) flex-direction (c) gap (d) align-items
  10. 10.What does justify-content: space-between do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  11. 11.🖌️ How big is the text, in px?
    h1 {
      font-size: 24px;
      text-align: right;
      background-color: black;
      color: orange;
    }
  12. 12.What does background-color do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) sets the letter colour
  13. 13.True or false: JavaScript lays out the page. (a) False (b) True
  14. 14.What does justify-content: flex-start do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  15. 15.✍️ What is the selector in this CSS rule?
    body {
      padding: 8px;
      text-align: center;
    }
    (a) center (b) body (c) .box (d) padding
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  17. 17.🔍 Which is the odd one out? (a) adds space around boxes (b) checks a quiz answer (c) rounds box corners (d) sets colours and fonts
  18. 18.Which of these does HTML do? (a) makes headings and lists (b) checks a quiz answer (c) counts down a timer (d) rounds box corners
  19. 19.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
  20. 20.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) .star (b) .box (c) .end (d) #box
  21. 21.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
  22. 22.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  23. 23.🎯 Which sign starts a class selector? (a) . (b) & (c) # (d) @
  24. 24.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  25. 25.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  26. 26.True or false: .big is a class selector. (a) True (b) False
  27. 27.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  28. 28.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  29. 29.🌈 Which hex code is red? (a) #ff00ff (b) #ff0000 (c) #000000 (d) #00ff00
  30. 30.🎯 Which CSS selector matches this element?
    <li class="red" id="end">Hello</li>
    (a) .box (b) #red (c) li (d) #hero
  31. 31.True or false: the content is the text or picture. (a) False (b) True
  32. 32.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  33. 33.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) gives the page structure (d) changes the text size
  34. 34.✍️ What is the selector in this CSS rule?
    li {
      padding: 8px;
      text-align: center;
      font-weight: bold;
    }
    (a) center (b) padding (c) li (d) body
  35. 35.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    #main { color: purple; }
    p { color: yellow; }
    .red { color: black; }
    (a) black (b) orange (c) yellow (d) purple
  36. 36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 180px;
      padding: 20px;
      border: 4px solid black;
      margin: 5px;
    }
  37. 37.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) center (d) space-between
  38. 38.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  39. 39.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 20px;
      border: 4px solid black;
      margin: 5px;
    }
  40. 40.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector

Answer key

  1. 12
  2. .big
  3. makes the text bold
  4. font-weight
  5. on the left
  6. Yes
  7. 12
  8. False
  9. align-items
  10. equal gaps, none at ends
  11. 24
  12. colours behind the text
  13. False
  14. packs boxes at the start
  15. body
  16. 122
  17. checks a quiz answer
  18. makes headings and lists
  19. an id selector
  20. .box
  21. :
  22. 10
  23. .
  24. HTML
  25. an element selector
  26. True
  27. 50
  28. 20
  29. #ff0000
  30. li
  31. True
  32. 20
  33. changes the text size
  34. li
  35. purple
  36. 228
  37. flex-end
  38. Yes
  39. 208
  40. a class selector

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