← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 957 · 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 a link (c) gives the page structure (d) adds space around boxes
  2. 2.✍️ What value is given to font-weight in this rule?
    p {
      font-weight: bold;
      color: red;
      text-align: center;
    }
    (a) 300px (b) font-weight (c) 2px solid (d) bold
  3. 3.True or false: body is an element selector. (a) True (b) False
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: black; }
    #logo { color: blue; }
    (a) black (b) yellow (c) blue (d) white
  5. 5.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) blue (c) black (d) bright green
  6. 6.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  7. 7.🎯 Which CSS selector matches this element?
    <h1 class="big" id="hero">Hello</h1>
    (a) .hero (b) #hero (c) #big (d) .red
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 440px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  9. 9.✍️ What value is given to background-color in this rule?
    p {
      background-color: yellow;
      color: red;
      font-size: 20px;
    }
    (a) 10px (b) background-color (c) yellow (d) 8px
  10. 10.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) center (d) flex-end
  11. 11.🧩 Which language counts down a timer? (a) CSS (b) HTML (c) JavaScript
  12. 12.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  13. 13.🎯 Which element does the selector h1 style? (a) <li class="big"> (b) <div id="main"> (c) <h1 class="big"> (d) <h2>
  14. 14.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
  15. 15.What does font-family do? (a) colours behind the text (b) makes letters bigger (c) sets the letter colour (d) picks the font style
  16. 16.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) background-color (d) color
  17. 17.✍️ What value is given to font-weight in this rule?
    .box {
      text-align: center;
      font-weight: bold;
    }
    (a) bold (b) font-weight (c) 300px (d) 2px solid
  18. 18.Which of these does HTML do? (a) shows a pop-up message (b) changes the page live (c) makes a form box (d) lays out the page
  19. 19.What does background-color do? (a) makes letters bigger (b) centres a heading (c) colours behind the text (d) makes the text bold
  20. 20.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
  21. 21.🖌️ What colour are the letters?
    p {
      font-size: 16px;
      text-align: center;
      color: blue;
      background-color: yellow;
    }
    (a) white (b) blue (c) yellow
  22. 22.🌈 Which colour of light is strongest in rgb(56, 205, 75)? (a) green (b) red (c) blue
  23. 23.✍️ What is the selector in this CSS rule?
    p {
      font-style: italic;
      background-color: yellow;
      text-align: center;
      padding: 8px;
    }
    (a) yellow (b) font-style (c) p (d) .note
  24. 24.🌈 Which colour is #00ff00? (a) red (b) white (c) magenta (d) bright green
  25. 25.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: white; }
    (a) white (b) purple (c) orange (d) yellow
  27. 27.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 10px;
      border: 5px solid black;
      margin: 5px;
    }
  28. 28.True or false: HTML shows a pop-up message. (a) True (b) False
  29. 29.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) red (d) blue
  30. 30.✍️ What is the selector in this CSS rule?
    h2 {
      padding: 8px;
      text-align: center;
    }
    (a) h1 (b) h2 (c) center (d) padding
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      width: 300px;
      margin: 10px;
      text-align: center;
    }
  32. 32.🖌️ How big is the text, in px?
    p {
      text-align: left;
      color: orange;
      font-size: 12px;
      background-color: red;
    }
  33. 33.Which of these does CSS do? (a) puts a picture on a page (b) sets colours and fonts (c) shows a pop-up message (d) checks a quiz answer
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    .red { color: red; }
    h2 { color: blue; }
    (a) blue (b) orange (c) red (d) green
  35. 35.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
  36. 36.🖌️ Which CSS property picks the font style? (a) font-size (b) background-color (c) font-family (d) font-weight
  37. 37.What does color do? (a) centres a heading (b) colours behind the text (c) makes the text bold (d) sets the letter colour
  38. 38.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  39. 39.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 100 (c) 1000 (d) 99
  40. 40.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector

Answer key

  1. adds space around boxes
  2. bold
  3. True
  4. blue
  5. blue
  6. 16
  7. #hero
  8. 70
  9. yellow
  10. flex-start
  11. JavaScript
  12. an id selector
  13. <h1 class="big">
  14. <link>
  15. picks the font style
  16. background-color
  17. bold
  18. makes a form box
  19. colours behind the text
  20. color
  21. blue
  22. green
  23. p
  24. bright green
  25. padding
  26. white
  27. 220
  28. False
  29. red
  30. h2
  31. 4
  32. 12
  33. sets colours and fonts
  34. red
  35. the viewport meta tag
  36. font-family
  37. sets the letter colour
  38. No
  39. 255
  40. a class selector

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