← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 718 · 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.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) makes a link (d) counts down a timer
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  3. 3.✍️ Which property is set to 8px in this rule?
    li {
      margin: 10px;
      padding: 8px;
    }
    (a) font-weight (b) border (c) 8px (d) padding
  4. 4.What does font-family do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) picks the font style
  5. 5.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
  6. 6.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) white (c) red (d) bright green
  7. 7.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  9. 9.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  10. 10.What does font-size do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  11. 11.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
  12. 12.True or false: li is an element selector. (a) True (b) False
  13. 13.🖌️ What colour are the letters?
    p {
      text-align: left;
      font-size: 16px;
      background-color: green;
      color: blue;
    }
    (a) blue (b) green (c) black
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    #top { color: blue; }
    .red { color: purple; }
    h2 { color: green; }
    (a) blue (b) purple (c) red (d) green
  15. 15.🎯 Which CSS selector matches this element?
    <h1 class="star" id="hero">Hello</h1>
    (a) .hero (b) #top (c) #star (d) .star
  16. 16.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  17. 17.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) align-items
  18. 18.✍️ What is the selector in this CSS rule?
    .note {
      font-size: 20px;
      padding: 8px;
      text-align: center;
      font-style: italic;
    }
    (a) .note (b) 8px (c) #top (d) font-size
  19. 19.✍️ Which property is set to center in this rule?
    h1 {
      padding: 8px;
      text-align: center;
    }
    (a) background-color (b) text-align (c) margin (d) center
  20. 20.✍️ Which property is set to center in this rule?
    p {
      color: red;
      text-align: center;
      font-size: 20px;
    }
    (a) center (b) text-align (c) background-color (d) margin
  21. 21.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
  22. 22.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) adds space around boxes (d) gives the page structure
  23. 23.✍️ What value is given to background-color in this rule?
    li {
      color: red;
      background-color: yellow;
    }
    (a) yellow (b) background-color (c) 8px (d) 10px
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    #hero { color: red; }
    h2 { color: orange; }
    (a) orange (b) red (c) yellow (d) blue
  25. 25.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
  26. 26.True or false: .note is a class selector. (a) False (b) True
  27. 27.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  28. 28.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  29. 29.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }
  31. 31.🎯 What kind of selector is #logo? (a) an element selector (b) an id selector (c) a class selector
  32. 32.🖌️ What colour is behind the letters?
    h1 {
      background-color: black;
      text-align: center;
      font-size: 20px;
      color: orange;
    }
    (a) orange (b) white (c) black
  33. 33.True or false: HTML makes headings and lists. (a) False (b) True
  34. 34.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
  35. 35.True or false: .star is an element selector. (a) True (b) False
  36. 36.🎯 Can many elements share the same class? (a) Yes (b) No
  37. 37.✍️ What is the selector in this CSS rule?
    .box {
      font-size: 20px;
      border: 2px solid;
      margin: 10px;
      font-style: italic;
    }
    (a) font-size (b) h2 (c) .box (d) 2px solid
  38. 38.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  39. 39.🎯 Which sign starts an id selector? (a) . (b) @ (c) # (d) &
  40. 40.True or false: the content is the text or picture. (a) True (b) False

Answer key

  1. counts down a timer
  2. 80
  3. padding
  4. picks the font style
  5. 255
  6. red
  7. an element selector
  8. 40
  9. :
  10. makes letters bigger
  11. the later one
  12. True
  13. blue
  14. blue
  15. .star
  16. HTML
  17. flex-direction
  18. .note
  19. text-align
  20. text-align
  21. blue
  22. gives the page structure
  23. yellow
  24. red
  25. JavaScript
  26. True
  27. 18
  28. 14
  29. 18
  30. 266
  31. an id selector
  32. black
  33. True
  34. a class selector
  35. False
  36. Yes
  37. .box
  38. an id selector
  39. #
  40. True

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