← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 553 · 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 is the selector in this CSS rule?
    p {
      font-weight: bold;
      border: 2px solid;
    }
    (a) .note (b) font-weight (c) p (d) 2px solid
  2. 2.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 420px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  3. 3.Which of these is padding? (a) the gap round content (b) space outside the border (c) the gap to other boxes (d) a solid or dotted edge
  4. 4.True or false: padding is space inside the border. (a) True (b) False
  5. 5.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) 2 (d) any number
  6. 6.✍️ Which property is set to yellow in this rule?
    h1 {
      border: 2px solid;
      color: red;
      background-color: yellow;
      font-style: italic;
    }
    (a) yellow (b) padding (c) margin (d) background-color
  7. 7.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 420px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  9. 9.🖌️ How big is the text, in px?
    h1 {
      font-size: 28px;
      color: black;
      background-color: yellow;
      text-align: right;
    }
  10. 10.🌈 Which colour of light is strongest in rgb(89, 70, 169)? (a) green (b) blue (c) red
  11. 11.✍️ What is the selector in this CSS rule?
    body {
      margin: 10px;
      background-color: yellow;
      color: red;
    }
    (a) yellow (b) .box (c) body (d) margin
  12. 12.🖌️ How big is the text, in px?
    h2 {
      background-color: black;
      color: yellow;
      font-size: 28px;
      text-align: left;
    }
  13. 13.🖌️ Where does the text sit on its line?
    p {
      color: yellow;
      font-size: 16px;
      background-color: blue;
      text-align: right;
    }
    (a) in the middle (b) on the right (c) on the left
  14. 14.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) blue (c) black (d) magenta
  15. 15.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  16. 16.✍️ In color: blue; which part is the property? (a) : (b) ; (c) blue (d) color
  17. 17.🌈 In #003d00 the green part is the hex number 3d. What is it as a normal number?
  18. 18.🎯 What kind of selector is .card? (a) a class selector (b) an element selector (c) an id selector
  19. 19.🌈 Which colour is #00ff00? (a) bright green (b) magenta (c) red (d) yellow
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 460px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  21. 21.🌈 Which hex code is black? (a) #ffff00 (b) #0000ff (c) #000000 (d) #00ff00
  22. 22.🔍 Which is the odd one out? (a) reacts to a button click (b) puts a picture on a page (c) shows a pop-up message (d) changes the page live
  23. 23.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
  24. 24.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      font-size: 24px;
      color: green;
      background-color: red;
    }
    (a) on the left (b) in the middle (c) on the right
  25. 25.Which of these does CSS do? (a) shows a pop-up message (b) changes the page live (c) makes a form box (d) sets colours and fonts
  26. 26.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  27. 27.✍️ What value is given to font-weight in this rule?
    h2 {
      font-weight: bold;
      padding: 8px;
      color: red;
    }
    (a) 300px (b) bold (c) 2px solid (d) font-weight
  28. 28.📦 In the box model, which part is the line round the box? (a) content (b) border (c) margin (d) padding
  29. 29.🎯 Which CSS selector matches this element?
    <h1 class="note" id="intro">Hello</h1>
    (a) h1 (b) #note (c) h2 (d) .intro
  30. 30.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) the gap round content (d) space inside the border
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      margin: 10px;
      font-size: 20px;
    }
  32. 32.Which of these does CSS do? (a) makes a form box (b) changes the page live (c) makes headings and lists (d) adds space around boxes
  33. 33.True or false: CSS puts a picture on a page. (a) True (b) False
  34. 34.Which of these does HTML do? (a) counts down a timer (b) rounds box corners (c) changes the page live (d) makes a form box
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
    }
  36. 36.🎯 Which element does the selector #logo style? (a) <h1 class="logo"> (b) <h1 id="logo"> (c) <h1 id="end"> (d) <h2 class="menu">
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      text-align: center;
    }
  38. 38.🎯 What kind of selector is .menu? (a) a class selector (b) an id selector (c) an element selector
  39. 39.🌈 Which colour is #ff00ff? (a) cyan (b) black (c) magenta (d) blue
  40. 40.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F

Answer key

  1. p
  2. 60
  3. the gap round content
  4. True
  5. 1
  6. background-color
  7. /*
  8. 50
  9. 28
  10. blue
  11. body
  12. 28
  13. on the right
  14. blue
  15. No
  16. color
  17. 61
  18. a class selector
  19. bright green
  20. 60
  21. #000000
  22. puts a picture on a page
  23. CSS
  24. on the left
  25. sets colours and fonts
  26. 16
  27. bold
  28. border
  29. h1
  30. the gap to other boxes
  31. 3
  32. adds space around boxes
  33. False
  34. makes a form box
  35. 1
  36. <h1 id="logo">
  37. 2
  38. a class selector
  39. magenta
  40. F

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