← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 422 · 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 strongest? (a) a class selector (b) an element selector (c) an id selector
  2. 2.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-size (c) font-family (d) color
  3. 3.Which of these does JavaScript do? (a) puts a picture on a page (b) shows a pop-up message (c) gives the page structure (d) changes the text size
  4. 4.🖌️ What colour is behind the letters?
    p {
      font-size: 20px;
      text-align: left;
      background-color: green;
      color: white;
    }
    (a) yellow (b) green (c) white
  5. 5.What does font-size do? (a) makes letters bigger (b) colours behind the text (c) centres a heading (d) makes the text bold
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 20px;
      border: 1px solid black;
      margin: 15px;
    }
  7. 7.🖌️ Where does the text sit on its line?
    li {
      color: yellow;
      text-align: left;
      font-size: 32px;
      background-color: blue;
    }
    (a) in the middle (b) on the left (c) on the right
  8. 8.✍️ What value is given to font-weight in this rule?
    body {
      font-weight: bold;
      padding: 8px;
      background-color: yellow;
    }
    (a) bold (b) font-weight (c) 300px (d) 2px solid
  9. 9.What does justify-content: flex-end do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  11. 11.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) blue (d) white
  12. 12.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    .big { color: blue; }
    .big { color: white; }
    (a) blue (b) white (c) black (d) yellow
  13. 13.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 99 (d) 100
  14. 14.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) color (d) font-family
  15. 15.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  16. 16.🌈 Which hex code is yellow? (a) #00ffff (b) #ffff00 (c) #ff0000 (d) #000000
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      width: 300px;
    }
  18. 18.True or false: HTML puts a picture on a page. (a) False (b) True
  19. 19.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
  20. 20.🖌️ Where does the text sit on its line?
    h1 {
      background-color: red;
      color: blue;
      text-align: left;
      font-size: 16px;
    }
    (a) on the right (b) in the middle (c) on the left
  21. 21.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
  22. 22.True or false: padding is space inside the border. (a) True (b) False
  23. 23.📱 What does a media query check? (a) the time of day (b) the page title (c) the screen width (d) the battery level
  24. 24.🌈 Which colour is #ff00ff? (a) black (b) magenta (c) blue (d) red
  25. 25.🧩 Which language shows a pop-up message? (a) HTML (b) CSS (c) JavaScript
  26. 26.🌈 In #00af00 the green part is the hex number af. What is it as a normal number?
  27. 27.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
  28. 28.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  29. 29.🎯 Which element does the selector li style? (a) <span class="big"> (b) <p id="hero"> (c) <div> (d) <li class="big">
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  31. 31.💪 Which flexbox property sets space between boxes? (a) align-items (b) display: flex (c) gap (d) flex-direction
  32. 32.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      border: 2px solid;
      font-size: 20px;
    }
    (a) 2px solid (b) .box (c) body (d) text-align
  33. 33.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  34. 34.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  35. 35.🎯 Which CSS selector matches this element?
    <h1 class="note" id="logo">Hello</h1>
    (a) #end (b) .big (c) #note (d) .note
  36. 36.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or narrower (d) 800px or wider
  37. 37.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      text-align: center;
      padding: 8px;
      font-size: 20px;
    }
    (a) center (b) h1 (c) h2 (d) font-style
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  39. 39.📦 In the box model, which part is the gap to other boxes? (a) padding (b) border (c) margin (d) content
  40. 40.True or false: JavaScript reacts to a button click. (a) True (b) False

Answer key

  1. an id selector
  2. font-size
  3. shows a pop-up message
  4. green
  5. makes letters bigger
  6. 212
  7. on the left
  8. bold
  9. packs boxes at the end
  10. 60
  11. blue
  12. white
  13. 255
  14. background-color
  15. 600px or narrower
  16. #ffff00
  17. 2
  18. True
  19. 32
  20. on the left
  21. ;
  22. True
  23. the screen width
  24. magenta
  25. JavaScript
  26. 175
  27. /*
  28. 20
  29. <li class="big">
  30. 100
  31. gap
  32. body
  33. No
  34. JavaScript
  35. .note
  36. 800px or wider
  37. h2
  38. 50
  39. margin
  40. True

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