← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 831 · 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 selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  2. 2.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  3. 3.True or false: padding is space inside the border. (a) False (b) True
  4. 4.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  5. 5.Which of these does JavaScript do? (a) makes a link (b) gives the page structure (c) makes headings and lists (d) changes the page live
  6. 6.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  7. 7.True or false: padding is a solid or dotted edge. (a) True (b) False
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    #main { color: white; }
    #main { color: red; }
    (a) white (b) orange (c) purple (d) red
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    #hero { color: yellow; }
    .menu { color: green; }
    (a) orange (b) purple (c) green (d) yellow
  10. 10.True or false: padding is the gap round content. (a) True (b) False
  11. 11.🎯 Which CSS selector matches this element?
    <li class="big" id="hero">Hello</li>
    (a) li (b) #top (c) div (d) #big
  12. 12.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  13. 13.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      color: orange;
      font-size: 24px;
      background-color: yellow;
    }
    (a) in the middle (b) on the right (c) on the left
  14. 14.🖌️ What colour are the letters?
    li {
      background-color: yellow;
      color: white;
      text-align: right;
      font-size: 16px;
    }
    (a) white (b) yellow (c) orange
  15. 15.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  16. 16.🌈 In #680000 the red part is the hex number 68. What is it as a normal number?
  17. 17.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-size (c) text-align (d) font-family
  18. 18.✍️ Which property is set to 8px in this rule?
    li {
      border: 2px solid;
      font-size: 20px;
      color: red;
      padding: 8px;
    }
    (a) border (b) font-weight (c) 8px (d) padding
  19. 19.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 99 (d) 100
  20. 20.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  21. 21.🌈 Which colour is rgb(0, 0, 255)? (a) bright green (b) yellow (c) blue (d) red
  22. 22.🖌️ What colour are the letters?
    h1 {
      font-size: 20px;
      text-align: center;
      background-color: green;
      color: white;
    }
    (a) orange (b) green (c) white
  23. 23.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
  24. 24.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  25. 25.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  26. 26.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) red (d) black
  27. 27.🔍 Which is the odd one out? (a) checks a quiz answer (b) counts down a timer (c) lays out the page (d) shows a pop-up message
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      background-color: yellow;
      padding: 8px;
    }
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    .note { color: green; }
    #intro { color: white; }
    h1 { color: black; }
    (a) white (b) green (c) black (d) purple
  30. 30.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) ; (d) .
  31. 31.🌈 Which colour of light is strongest in rgb(117, 180, 113)? (a) red (b) blue (c) green
  32. 32.True or false: margin is space outside the border. (a) True (b) False
  33. 33.📦 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: 10px;
    }
  34. 34.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
  35. 35.True or false: the content is space inside the border. (a) True (b) False
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 5px;
      border: 4px solid black;
      margin: 20px;
    }
  37. 37.🌈 Which colour is #ff00ff? (a) white (b) magenta (c) cyan (d) yellow
  38. 38.🎯 How many elements on a page should have the same id? (a) any number (b) 5 (c) 1 (d) 2
  39. 39.🎯 Which CSS selector matches this element?
    <span class="box" id="hero">Hello</span>
    (a) #top (b) #box (c) #hero (d) p
  40. 40.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }

Answer key

  1. an element selector
  2. 20
  3. True
  4. No
  5. changes the page live
  6. 16
  7. False
  8. red
  9. yellow
  10. True
  11. li
  12. No
  13. on the left
  14. white
  15. 70
  16. 104
  17. font-weight
  18. padding
  19. 255
  20. a class selector
  21. blue
  22. white
  23. blue
  24. 70
  25. No
  26. red
  27. lays out the page
  28. 2
  29. white
  30. ;
  31. green
  32. True
  33. 214
  34. a class selector
  35. False
  36. 288
  37. magenta
  38. 1
  39. #hero
  40. 26

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