← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 676 · 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 element does the selector #top style? (a) <p id="intro"> (b) <p id="top"> (c) <p class="top"> (d) <h1 class="red">
  2. 2.🖌️ Which CSS property makes letters bigger? (a) text-align (b) font-weight (c) background-color (d) font-size
  3. 3.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  4. 4.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  5. 5.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <img> (d) <css>
  6. 6.Which of these does CSS do? (a) rounds box corners (b) counts down a timer (c) puts a picture on a page (d) makes headings and lists
  7. 7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  8. 8.🖌️ What colour are the letters?
    h1 {
      background-color: black;
      color: green;
      text-align: center;
      font-size: 28px;
    }
    (a) white (b) black (c) green
  9. 9.🌈 Which colour is #ff00ff? (a) cyan (b) red (c) magenta (d) blue
  10. 10.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) yellow (c) cyan (d) white
  11. 11.📦 In the box model, which part is the gap round content? (a) border (b) padding (c) content (d) margin
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    #end { color: purple; }
    h2 { color: orange; }
    .note { color: black; }
    (a) purple (b) orange (c) blue (d) black
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      width: 300px;
    }
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    #top { color: black; }
    .box { color: green; }
    h1 { color: orange; }
    (a) black (b) green (c) orange (d) blue
  15. 15.✍️ What is the selector in this CSS rule?
    .box {
      width: 300px;
      background-color: yellow;
    }
    (a) yellow (b) width (c) .box (d) h2
  16. 16.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) 600px or narrower (d) exactly 1000px
  17. 17.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .js (d) .css
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 5px;
      border: 4px solid black;
      margin: 15px;
    }
  19. 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  20. 20.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: yellow; }
    .note { color: blue; }
    (a) yellow (b) purple (c) orange (d) blue
  21. 21.What does justify-content: space-between do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  22. 22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 90px;
      padding: 15px;
      border: 1px solid black;
      margin: 15px;
    }
  23. 23.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  24. 24.True or false: HTML makes a link. (a) False (b) True
  25. 25.💪 Which flexbox property spaces boxes along a row? (a) gap (b) align-items (c) display: flex (d) justify-content
  26. 26.🌈 Which colour is #ff0000? (a) magenta (b) cyan (c) black (d) red
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      text-align: center;
      color: red;
      width: 300px;
      margin: 10px;
    }
  28. 28.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  29. 29.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: black; }
    .big { color: blue; }
    (a) green (b) blue (c) black (d) yellow
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 20px;
      border: 2px solid black;
      margin: 5px;
    }
  31. 31.✍️ In color: blue; which part is the value? (a) : (b) color (c) ; (d) blue
  32. 32.🖌️ What colour are the letters?
    li {
      background-color: green;
      font-size: 12px;
      text-align: left;
      color: white;
    }
    (a) green (b) white (c) purple
  33. 33.🧩 Which language makes a form box? (a) HTML (b) JavaScript (c) CSS
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
      padding: 8px;
      border: 2px solid;
      font-size: 20px;
    }
  35. 35.🎯 Which CSS selector matches this element?
    <h1 class="note" id="hero">Hello</h1>
    (a) .big (b) .hero (c) #note (d) #hero
  36. 36.📱 What does a media query check? (a) the screen width (b) the time of day (c) the page title (d) the battery level
  37. 37.🎯 What kind of selector is img? (a) an id selector (b) a class selector (c) an element selector
  38. 38.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  39. 39.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).

Answer key

  1. <p id="top">
  2. font-size
  3. 20
  4. 14
  5. <link>
  6. rounds box corners
  7. 14
  8. green
  9. magenta
  10. white
  11. padding
  12. purple
  13. 1
  14. black
  15. .box
  16. 600px or narrower
  17. .css
  18. 168
  19. the later one
  20. yellow
  21. equal gaps, none at ends
  22. 122
  23. 18
  24. True
  25. justify-content
  26. red
  27. 4
  28. flex-start
  29. blue
  30. 264
  31. blue
  32. white
  33. HTML
  34. 4
  35. #hero
  36. the screen width
  37. an element selector
  38. HTML
  39. an id selector
  40. 30

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