← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 867 · 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 font-size do? (a) makes the text bold (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  2. 2.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  3. 3.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  4. 4.🖌️ What colour are the letters?
    h2 {
      text-align: left;
      background-color: purple;
      color: blue;
      font-size: 40px;
    }
    (a) black (b) purple (c) blue
  5. 5.True or false: CSS sets colours and fonts. (a) False (b) True
  6. 6.🎯 Which element does the selector .note style? (a) <h1 class="big"> (b) <h1 id="note"> (c) <h1 class="note"> (d) <h2 class="red">
  7. 7.🌈 Which hex code is cyan? (a) #000000 (b) #0000ff (c) #00ffff (d) #ff00ff
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-style: italic;
    }
  9. 9.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  10. 10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  11. 11.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
  12. 12.💪 Which flexbox property picks row or column? (a) flex-direction (b) gap (c) align-items (d) display: flex
  13. 13.🎯 Which element does the selector h1 style? (a) <li class="menu"> (b) <h1 class="menu"> (c) <h2> (d) <div id="intro">
  14. 14.🖌️ What colour is behind the letters?
    li {
      text-align: left;
      background-color: red;
      color: white;
      font-size: 20px;
    }
    (a) red (b) white (c) yellow
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    #intro { color: blue; }
    h2 { color: green; }
    (a) purple (b) green (c) blue (d) black
  16. 16.🎯 Which sign starts a class selector? (a) & (b) # (c) @ (d) .
  17. 17.🖌️ What colour is behind the letters?
    li {
      font-size: 24px;
      text-align: left;
      background-color: blue;
      color: yellow;
    }
    (a) blue (b) yellow (c) purple
  18. 18.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the hr tag (d) the viewport meta tag
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  20. 20.🎯 What kind of selector is h1? (a) a class selector (b) an element selector (c) an id selector
  21. 21.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      color: red;
      padding: 8px;
      font-size: 20px;
    }
    (a) border (b) h2 (c) h1 (d) red
  22. 22.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 100 (c) 1000 (d) 99
  23. 23.True or false: padding is the text or picture. (a) False (b) True
  24. 24.🌈 Which hex code is bright green? (a) #00ff00 (b) #ffff00 (c) #ff0000 (d) #000000
  25. 25.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    .note { color: purple; }
    h1 { color: black; }
    #intro { color: blue; }
    (a) purple (b) black (c) orange (d) blue
  27. 27.True or false: margin is space outside the border. (a) False (b) True
  28. 28.🎯 Which element does the selector .box style? (a) <span class="box"> (b) <span class="star"> (c) <p class="menu"> (d) <span id="box">
  29. 29.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
  30. 30.True or false: .star is an element selector. (a) False (b) True
  31. 31.🌈 In #fc0000 the red part is the hex number fc. What is it as a normal number?
  32. 32.✍️ What is the selector in this CSS rule?
    p {
      font-weight: bold;
      text-align: center;
      padding: 8px;
      color: red;
    }
    (a) p (b) font-weight (c) .note (d) center
  33. 33.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 460px;
      justify-content: center;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  35. 35.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) align-items (d) justify-content
  36. 36.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  37. 37.True or false: #hero is an element selector. (a) False (b) True
  38. 38.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  39. 39.🖌️ Where does the text sit on its line?
    h1 {
      text-align: right;
      background-color: yellow;
      color: black;
      font-size: 32px;
    }
    (a) on the right (b) on the left (c) in the middle
  40. 40.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) padding (c) border (d) content

Answer key

  1. makes letters bigger
  2. HTML
  3. No
  4. blue
  5. True
  6. <h1 class="note">
  7. #00ffff
  8. 1
  9. 1
  10. 24
  11. <link>
  12. flex-direction
  13. <h1 class="menu">
  14. red
  15. blue
  16. .
  17. blue
  18. the viewport meta tag
  19. 70
  20. an element selector
  21. h2
  22. 255
  23. False
  24. #00ff00
  25. 18
  26. blue
  27. True
  28. <span class="box">
  29. equal gaps, none at ends
  30. False
  31. 252
  32. p
  33. 80
  34. 80
  35. display: flex
  36. Yes
  37. False
  38. No
  39. on the right
  40. border

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