← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 725 · 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 element does the selector #logo style? (a) <li class="logo"> (b) <div class="red"> (c) <li id="logo"> (d) <li id="end">
  2. 2.✍️ What value is given to font-weight in this rule?
    li {
      font-style: italic;
      font-weight: bold;
      color: red;
    }
    (a) font-weight (b) bold (c) 2px solid (d) 300px
  3. 3.🖌️ Which CSS property makes letters bigger? (a) font-size (b) background-color (c) font-family (d) font-weight
  4. 4.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
  5. 5.🖌️ What colour is behind the letters?
    p {
      color: green;
      font-size: 40px;
      text-align: center;
      background-color: red;
    }
    (a) red (b) green (c) blue
  6. 6.🎯 Which element does the selector .red style? (a) <li id="red"> (b) <div class="star"> (c) <li class="red"> (d) <li class="box">
  7. 7.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  8. 8.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    .star { color: black; }
    .star { color: red; }
    (a) red (b) black (c) orange (d) white
  9. 9.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 2 (d) 3
  10. 10.True or false: .menu is an element selector. (a) True (b) False
  11. 11.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
  12. 12.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) padding (d) border
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
      margin: 10px;
      font-size: 20px;
      border: 2px solid;
    }
  14. 14.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  15. 15.🌈 Which colour of light is strongest in rgb(98, 203, 121)? (a) green (b) red (c) blue
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
      font-size: 20px;
      background-color: yellow;
      color: red;
    }
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  18. 18.🌈 In #000079 the blue part is the hex number 79. What is it as a normal number?
  19. 19.🖌️ Where does the text sit on its line?
    li {
      background-color: yellow;
      text-align: center;
      color: black;
      font-size: 20px;
    }
    (a) on the right (b) on the left (c) in the middle
  20. 20.✍️ Which property is set to red in this rule?
    #top {
      color: red;
      padding: 8px;
    }
    (a) red (b) color (c) text-align (d) font-size
  21. 21.True or false: #hero is an element selector. (a) False (b) True
  22. 22.True or false: HTML makes a link. (a) False (b) True
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  24. 24.✍️ What is the selector in this CSS rule?
    .note {
      font-weight: bold;
      border: 2px solid;
    }
    (a) 2px solid (b) font-weight (c) .note (d) #top
  25. 25.✍️ In color: blue; which part is the property? (a) ; (b) : (c) blue (d) color
  26. 26.🎯 Which CSS selector matches this element?
    <p class="red" id="main">Hello</p>
    (a) .main (b) #logo (c) #red (d) #main
  27. 27.🎯 Which CSS selector matches this element?
    <li class="box" id="end">Hello</li>
    (a) #box (b) .box (c) .star (d) div
  28. 28.🎯 Which CSS selector matches this element?
    <p class="star" id="intro">Hello</p>
    (a) .menu (b) #star (c) h1 (d) .star
  29. 29.🖌️ Where does the text sit on its line?
    h1 {
      background-color: blue;
      font-size: 28px;
      color: black;
      text-align: center;
    }
    (a) on the right (b) in the middle (c) on the left
  30. 30.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
  31. 31.True or false: padding is the gap round content. (a) True (b) False
  32. 32.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
  33. 33.🌈 Which hex code is red? (a) #0000ff (b) #000000 (c) #ff0000 (d) #00ff00
  34. 34.True or false: the content is space outside the border. (a) False (b) True
  35. 35.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
  36. 36.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  37. 37.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-style: italic;
      margin: 10px;
      border: 2px solid;
    }
  39. 39.🎯 Which element does the selector .menu style? (a) <h1 class="note"> (b) <h1 class="menu"> (c) <h1 id="menu"> (d) <h2 class="big">
  40. 40.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) border (c) padding (d) content

Answer key

  1. <li id="logo">
  2. bold
  3. font-size
  4. the viewport meta tag
  5. red
  6. <li class="red">
  7. Yes
  8. red
  9. 3
  10. False
  11. justify-content
  12. margin
  13. 4
  14. 20
  15. green
  16. 4
  17. 70
  18. 121
  19. in the middle
  20. color
  21. False
  22. True
  23. 126
  24. .note
  25. color
  26. #main
  27. .box
  28. .star
  29. in the middle
  30. HTML
  31. True
  32. color
  33. #ff0000
  34. False
  35. .
  36. 600px or narrower
  37. puts boxes in the middle
  38. 3
  39. <h1 class="menu">
  40. border

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