← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 149 · 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 colour is rgb(255, 255, 255)? (a) white (b) blue (c) cyan (d) magenta
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  3. 3.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
  4. 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
  5. 5.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  6. 6.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
  7. 7.✍️ Which property is set to red in this rule?
    #top {
      padding: 8px;
      font-weight: bold;
      font-size: 20px;
      color: red;
    }
    (a) text-align (b) font-size (c) color (d) red
  8. 8.✍️ What is the selector in this CSS rule?
    .box {
      background-color: yellow;
      border: 2px solid;
    }
    (a) background-color (b) h2 (c) .box (d) 2px solid
  9. 9.🌈 Which colour of light is strongest in rgb(0, 48, 223)? (a) green (b) red (c) blue
  10. 10.🖌️ What colour are the letters?
    p {
      background-color: blue;
      color: orange;
      text-align: center;
      font-size: 16px;
    }
    (a) blue (b) red (c) orange
  11. 11.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) .intro (b) div (c) .star (d) #box
  12. 12.True or false: margin is the line round the box. (a) True (b) False
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  14. 14.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
  15. 15.🖌️ Which CSS property picks the font style? (a) background-color (b) font-size (c) font-family (d) color
  16. 16.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  18. 18.🎯 Which element does the selector li style? (a) <div> (b) <p id="top"> (c) <li class="big"> (d) <span class="big">
  19. 19.True or false: h1 is an element selector. (a) True (b) False
  20. 20.🖌️ What colour are the letters?
    h2 {
      font-size: 40px;
      background-color: blue;
      text-align: center;
      color: black;
    }
    (a) black (b) yellow (c) blue
  21. 21.🎯 Which element does the selector .red style? (a) <div id="red"> (b) <div class="box"> (c) <div class="red"> (d) <span class="star">
  22. 22.🖌️ What colour are the letters?
    h2 {
      color: black;
      font-size: 40px;
      text-align: right;
      background-color: yellow;
    }
    (a) green (b) yellow (c) black
  23. 23.🌈 Which colour of light is strongest in rgb(24, 226, 69)? (a) red (b) green (c) blue
  24. 24.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
      margin: 10px;
    }
  27. 27.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 380px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 15px;
      border: 5px solid black;
      margin: 15px;
    }
  30. 30.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  32. 32.🎯 Which element does the selector p style? (a) <li id="intro"> (b) <p class="menu"> (c) <h1> (d) <h2 class="menu">
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 20px;
      border: 2px solid black;
      margin: 15px;
    }
  34. 34.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) red (c) green (d) white
  35. 35.Which of these does HTML do? (a) reacts to a button click (b) changes the text size (c) rounds box corners (d) puts a picture on a page
  36. 36.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  37. 37.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  38. 38.✍️ What value is given to padding in this rule?
    body {
      width: 300px;
      padding: 8px;
      font-style: italic;
      color: red;
    }
    (a) bold (b) 2px solid (c) 8px (d) padding
  39. 39.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  40. 40.🎯 What kind of selector is .big? (a) an element selector (b) a class selector (c) an id selector

Answer key

  1. white
  2. 240
  3. a class selector
  4. the later one
  5. Yes
  6. ;
  7. color
  8. .box
  9. blue
  10. orange
  11. div
  12. False
  13. 40
  14. border
  15. font-family
  16. No
  17. 10
  18. <li class="big">
  19. True
  20. black
  21. <div class="red">
  22. black
  23. green
  24. No
  25. 280
  26. 2
  27. an element selector
  28. 70
  29. 190
  30. packs boxes at the start
  31. 70
  32. <p class="menu">
  33. 224
  34. blue
  35. puts a picture on a page
  36. HTML
  37. an id selector
  38. 8px
  39. Yes
  40. a class selector

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