← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 750 · 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, 0)? (a) white (b) red (c) cyan (d) yellow
  2. 2.✍️ What value is given to border in this rule?
    #top {
      font-weight: bold;
      text-align: center;
      border: 2px solid;
      margin: 10px;
    }
    (a) italic (b) border (c) 2px solid (d) 300px
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #hero { color: blue; }
    (a) green (b) yellow (c) blue (d) white
  4. 4.✍️ What value is given to text-align in this rule?
    h2 {
      font-weight: bold;
      text-align: center;
    }
    (a) yellow (b) 10px (c) center (d) text-align
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      background-color: yellow;
      border: 2px solid;
      font-weight: bold;
    }
  6. 6.🖌️ Which CSS property colours behind the text? (a) text-align (b) font-weight (c) font-size (d) background-color
  7. 7.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-end (c) flex-start (d) center
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      width: 300px;
    }
  9. 9.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
  10. 10.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
  11. 11.🔍 Which is the odd one out? (a) reacts to a button click (b) counts down a timer (c) shows a pop-up message (d) puts a picture on a page
  12. 12.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
  13. 13.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 20px;
      border: 5px solid black;
      margin: 5px;
    }
  14. 14.True or false: JavaScript changes the page live. (a) True (b) False
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: white; }
    #top { color: black; }
    (a) white (b) red (c) purple (d) black
  16. 16.Which of these does CSS do? (a) makes headings and lists (b) gives the page structure (c) checks a quiz answer (d) sets colours and fonts
  17. 17.🌈 Which hex code is magenta? (a) #0000ff (b) #ff0000 (c) #00ff00 (d) #ff00ff
  18. 18.🖌️ Where does the text sit on its line?
    h1 {
      background-color: green;
      text-align: left;
      font-size: 20px;
      color: purple;
    }
    (a) on the left (b) on the right (c) in the middle
  19. 19.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
  20. 20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 270px;
      padding: 30px;
      border: 3px solid black;
      margin: 15px;
    }
  21. 21.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) src (d) style
  22. 22.🌈 Which hex code is red? (a) #000000 (b) #ff0000 (c) #0000ff (d) #00ffff
  23. 23.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      font-size: 20px;
      color: red;
      padding: 8px;
    }
    (a) body (b) 20px (c) border (d) li
  24. 24.🎯 What kind of selector is body? (a) an id selector (b) an element selector (c) a class selector
  25. 25.🌈 Which colour is rgb(0, 0, 255)? (a) bright green (b) white (c) blue (d) red
  26. 26.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) align-items (d) gap
  27. 27.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  28. 28.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  30. 30.True or false: margin is space outside the border. (a) True (b) False
  31. 31.What does justify-content: space-between 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
  32. 32.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
  33. 33.🖌️ Where does the text sit on its line?
    h1 {
      background-color: blue;
      text-align: right;
      font-size: 40px;
      color: purple;
    }
    (a) on the right (b) in the middle (c) on the left
  34. 34.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
  35. 35.🖌️ How big is the text, in px?
    li {
      color: green;
      font-size: 20px;
      text-align: center;
      background-color: purple;
    }
  36. 36.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    #intro { color: red; }
    #intro { color: yellow; }
    (a) black (b) yellow (c) purple (d) red
  37. 37.Which of these does HTML do? (a) reacts to a button click (b) adds space around boxes (c) makes a link (d) changes the page live
  38. 38.🌈 Which colour of light is strongest in rgb(40, 200, 117)? (a) blue (b) green (c) red
  39. 39.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    #top { color: yellow; }
    .red { color: orange; }
    p { color: purple; }
    (a) white (b) orange (c) purple (d) yellow
  40. 40.🖌️ How big is the text, in px?
    h1 {
      text-align: right;
      font-size: 36px;
      background-color: green;
      color: blue;
    }

Answer key

  1. yellow
  2. 2px solid
  3. blue
  4. center
  5. 3
  6. background-color
  7. center
  8. 2
  9. CSS
  10. an element selector
  11. puts a picture on a page
  12. .css
  13. 120
  14. True
  15. black
  16. sets colours and fonts
  17. #ff00ff
  18. on the left
  19. CSS
  20. 336
  21. style
  22. #ff0000
  23. li
  24. an element selector
  25. blue
  26. align-items
  27. an element selector
  28. an id selector
  29. 80
  30. True
  31. equal gaps, none at ends
  32. 600px or narrower
  33. on the right
  34. an id selector
  35. 20
  36. yellow
  37. makes a link
  38. green
  39. yellow
  40. 36

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