← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 77 · 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.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  4. 4.🎯 Which element does the selector .note style? (a) <h2 class="note"> (b) <li class="red"> (c) <h2 id="note"> (d) <h2 class="big">
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 440px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="box" id="intro">Hi</h2>
    CSS:
    .box { color: black; }
    .box { color: yellow; }
    (a) white (b) yellow (c) black (d) blue
  7. 7.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  8. 8.True or false: .big is a class selector. (a) True (b) False
  9. 9.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) font-size (d) font-weight
  10. 10.🧩 Which language checks a quiz answer? (a) JavaScript (b) HTML (c) CSS
  11. 11.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  12. 12.🖌️ What colour are the letters?
    p {
      font-size: 16px;
      text-align: center;
      color: blue;
      background-color: black;
    }
    (a) black (b) blue (c) yellow
  13. 13.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    .star { color: orange; }
    .star { color: white; }
    (a) green (b) purple (c) orange (d) white
  14. 14.✍️ What value is given to background-color in this rule?
    h2 {
      margin: 10px;
      background-color: yellow;
      font-style: italic;
      border: 2px solid;
    }
    (a) 10px (b) 8px (c) yellow (d) background-color
  15. 15.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the later one (d) the shorter one
  17. 17.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  18. 18.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: black; }
    p { color: orange; }
    (a) white (b) green (c) orange (d) black
  19. 19.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  20. 20.🌈 In #000097 the blue part is the hex number 97. What is it as a normal number?
  21. 21.True or false: .star is an element selector. (a) False (b) True
  22. 22.🎯 Which sign starts a class selector? (a) @ (b) # (c) . (d) &
  23. 23.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) center (c) flex-start (d) space-between
  24. 24.✍️ Which property is set to 20px in this rule?
    li {
      font-style: italic;
      font-size: 20px;
      color: red;
    }
    (a) background-color (b) 20px (c) text-align (d) font-size
  25. 25.True or false: CSS sets colours and fonts. (a) True (b) False
  26. 26.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) style (d) src
  27. 27.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    .box { color: blue; }
    #main { color: white; }
    h1 { color: yellow; }
    (a) white (b) yellow (c) blue (d) orange
  28. 28.True or false: padding is space inside the border. (a) True (b) False
  29. 29.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-size (d) font-family
  30. 30.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: purple; }
    (a) yellow (b) green (c) red (d) purple
  32. 32.Which of these does JavaScript do? (a) puts a picture on a page (b) makes a link (c) reacts to a button click (d) rounds box corners
  33. 33.Which of these does CSS do? (a) gives the page structure (b) shows a pop-up message (c) makes a link (d) changes the text size
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  35. 35.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 3 (c) 4 (d) 2
  36. 36.🌈 Which colour is #ff00ff? (a) yellow (b) bright green (c) magenta (d) blue
  37. 37.🖌️ What colour are the letters?
    li {
      background-color: white;
      font-size: 40px;
      text-align: center;
      color: purple;
    }
    (a) white (b) purple (c) red
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  39. 39.💪 Which flexbox property spaces boxes along a row? (a) gap (b) align-items (c) justify-content (d) flex-direction
  40. 40.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }

Answer key

  1. fits every screen
  2. 132
  3. 30
  4. <h2 class="note">
  5. 20
  6. yellow
  7. 24
  8. True
  9. background-color
  10. JavaScript
  11. packs boxes at the end
  12. blue
  13. white
  14. yellow
  15. a class selector
  16. the later one
  17. No
  18. orange
  19. 18
  20. 151
  21. False
  22. .
  23. center
  24. font-size
  25. True
  26. style
  27. white
  28. True
  29. font-family
  30. 30
  31. purple
  32. reacts to a button click
  33. changes the text size
  34. 246
  35. 3
  36. magenta
  37. purple
  38. 80
  39. justify-content
  40. 24

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