← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 197 · 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: HTML makes headings and lists. (a) True (b) False
  2. 2.Which of these does CSS do? (a) adds space around boxes (b) shows a pop-up message (c) gives the page structure (d) puts a picture on a page
  3. 3.Which of these is margin? (a) space outside the border (b) a solid or dotted edge (c) space inside the border (d) the gap round content
  4. 4.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) text-align (d) font-family
  5. 5.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
  6. 6.True or false: CSS gives the page structure. (a) False (b) True
  7. 7.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  8. 8.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  9. 9.What does justify-content: flex-end 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
  10. 10.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) space-between (d) flex-end
  11. 11.✍️ What value is given to margin in this rule?
    .box {
      font-weight: bold;
      margin: 10px;
    }
    (a) bold (b) 10px (c) margin (d) 8px
  12. 12.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) .intro (b) .star (c) #intro (d) span
  13. 13.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  14. 14.🖌️ Which CSS property colours behind the text? (a) font-size (b) background-color (c) font-weight (d) color
  15. 15.Which of these does JavaScript do? (a) makes headings and lists (b) lays out the page (c) gives the page structure (d) reacts to a button click
  16. 16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  17. 17.What does background-color do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) colours behind the text
  18. 18.True or false: margin is space inside the border. (a) False (b) True
  19. 19.🎯 Which CSS selector matches this element?
    <li class="star" id="end">Hello</li>
    (a) #star (b) .end (c) #end (d) div
  20. 20.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  21. 21.⚖️ What colour is the text of this element?
    <h2 class="red" id="main">Hi</h2>
    CSS:
    .red { color: green; }
    #main { color: yellow; }
    (a) green (b) yellow (c) orange (d) purple
  22. 22.What does color do? (a) sets the letter colour (b) colours behind the text (c) centres a heading (d) makes letters bigger
  23. 23.✍️ What value is given to font-size in this rule?
    #top {
      font-size: 20px;
      background-color: yellow;
    }
    (a) font-size (b) 20px (c) yellow (d) center
  24. 24.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  25. 25.🎯 Which element does the selector .menu style? (a) <li class="note"> (b) <li class="menu"> (c) <div class="big"> (d) <li id="menu">
  26. 26.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      text-align: left;
      color: red;
      font-size: 16px;
    }
    (a) red (b) blue (c) black
  27. 27.🖌️ What colour is behind the letters?
    h2 {
      font-size: 36px;
      background-color: blue;
      color: green;
      text-align: center;
    }
    (a) orange (b) blue (c) green
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 5px;
      border: 3px solid black;
      margin: 5px;
    }
  30. 30.🎯 What kind of selector is li? (a) an element selector (b) a class selector (c) an id selector
  31. 31.🌈 In #0000a3 the blue part is the hex number a3. What is it as a normal number?
  32. 32.🌈 Which hex code is red? (a) #00ffff (b) #000000 (c) #0000ff (d) #ff0000
  33. 33.🎯 Which CSS selector matches this element?
    <div class="note" id="intro">Hello</div>
    (a) #note (b) span (c) #intro (d) .big
  34. 34.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  35. 35.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
  36. 36.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) content (d) padding
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    h1 { color: black; }
    .box { color: yellow; }
    (a) yellow (b) black (c) blue (d) green
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  39. 39.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the viewport meta tag (d) the br tag
  40. 40.True or false: JavaScript lays out the page. (a) False (b) True

Answer key

  1. True
  2. adds space around boxes
  3. space outside the border
  4. color
  5. HTML
  6. False
  7. 16
  8. 156
  9. packs boxes at the end
  10. flex-start
  11. 10px
  12. #intro
  13. 16
  14. background-color
  15. reacts to a button click
  16. 24
  17. colours behind the text
  18. False
  19. #end
  20. { }
  21. yellow
  22. sets the letter colour
  23. 20px
  24. an id selector
  25. <li class="menu">
  26. red
  27. blue
  28. 20
  29. 196
  30. an element selector
  31. 163
  32. #ff0000
  33. #intro
  34. HTML
  35. #
  36. border
  37. yellow
  38. 70
  39. the viewport meta tag
  40. False

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