← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 966 · 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 colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    .note { color: blue; }
    .note { color: green; }
    (a) blue (b) yellow (c) white (d) green
  2. 2.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  3. 3.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) colours behind the text (d) picks the font style
  4. 4.🌈 Which colour is #ff0000? (a) cyan (b) white (c) black (d) red
  5. 5.🖌️ Which CSS property colours behind the text? (a) font-weight (b) color (c) background-color (d) font-family
  6. 6.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  7. 7.✍️ In color: blue; which part is the property? (a) ; (b) : (c) color (d) blue
  8. 8.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: orange; }
    (a) orange (b) white (c) purple (d) green
  9. 9.🖌️ How big is the text, in px?
    h1 {
      font-size: 36px;
      color: blue;
      text-align: center;
      background-color: orange;
    }
  10. 10.Which of these does HTML do? (a) rounds box corners (b) changes the text size (c) shows a pop-up message (d) makes a form box
  11. 11.✍️ What value is given to text-align in this rule?
    .note {
      text-align: center;
      background-color: yellow;
      font-weight: bold;
    }
    (a) text-align (b) 10px (c) center (d) yellow
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    .star { color: orange; }
    h1 { color: purple; }
    #hero { color: red; }
    (a) orange (b) green (c) purple (d) red
  13. 13.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  14. 14.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 15px;
      border: 2px solid black;
      margin: 15px;
    }
  15. 15.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the viewport meta tag (c) the hr tag (d) the br tag
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: blue; }
    #top { color: green; }
    (a) black (b) orange (c) blue (d) green
  17. 17.🌈 In #000088 the blue part is the hex number 88. What is it as a normal number?
  18. 18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 30px;
      border: 3px solid black;
      margin: 20px;
    }
  19. 19.✍️ What value is given to text-align in this rule?
    h1 {
      font-size: 20px;
      text-align: center;
      font-weight: bold;
    }
    (a) center (b) text-align (c) yellow (d) 10px
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    #main { color: purple; }
    #main { color: white; }
    (a) blue (b) white (c) green (d) purple
  21. 21.🎯 Which CSS selector matches this element?
    <div class="big" id="logo">Hello</div>
    (a) .logo (b) #logo (c) #end (d) #big
  22. 22.🌈 Which colour of light is strongest in rgb(234, 41, 82)? (a) red (b) blue (c) green
  23. 23.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
  24. 24.✍️ How does a CSS comment start? (a) /* (b) // (c) <!-- (d) #
  25. 25.True or false: CSS puts a picture on a page. (a) True (b) False
  26. 26.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) < > (d) { }
  27. 27.True or false: #end is a class selector. (a) False (b) True
  28. 28.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
  29. 29.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  30. 30.🖌️ What colour are the letters?
    li {
      color: black;
      text-align: left;
      background-color: green;
      font-size: 36px;
    }
    (a) green (b) orange (c) black
  31. 31.🌈 Which colour is #ff00ff? (a) white (b) cyan (c) magenta (d) bright green
  32. 32.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  33. 33.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  34. 34.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
  35. 35.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 5px;
      border: 1px solid black;
      margin: 0px;
    }
  37. 37.🎯 Which CSS selector matches this element?
    <h2 class="red" id="main">Hello</h2>
    (a) .main (b) #red (c) h2 (d) .box
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  39. 39.🖌️ What colour are the letters?
    h2 {
      text-align: center;
      color: purple;
      font-size: 20px;
      background-color: orange;
    }
    (a) yellow (b) purple (c) orange
  40. 40.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-end (c) center (d) flex-start

Answer key

  1. green
  2. an id selector
  3. picks the font style
  4. red
  5. background-color
  6. 26
  7. color
  8. orange
  9. 36
  10. makes a form box
  11. center
  12. red
  13. HTML
  14. 224
  15. the viewport meta tag
  16. green
  17. 136
  18. 166
  19. center
  20. white
  21. #logo
  22. red
  23. JavaScript
  24. /*
  25. False
  26. { }
  27. False
  28. margin
  29. Yes
  30. black
  31. magenta
  32. an id selector
  33. 172
  34. 3
  35. 16
  36. 102
  37. h2
  38. 60
  39. purple
  40. space-between

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