← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 178 · 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) magenta (b) white (c) cyan (d) yellow
  2. 2.Which of these does CSS do? (a) changes the text size (b) shows a pop-up message (c) changes the page live (d) puts a picture on a page
  3. 3.🌈 Which colour of light is strongest in rgb(214, 136, 106)? (a) green (b) blue (c) red
  4. 4.🌈 Which hex code is blue? (a) #ff0000 (b) #00ffff (c) #00ff00 (d) #0000ff
  5. 5.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  6. 6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      margin: 10px;
      color: red;
    }
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    .big { color: green; }
    #logo { color: red; }
    h2 { color: blue; }
    (a) blue (b) red (c) white (d) green
  9. 9.🖌️ How big is the text, in px?
    h1 {
      text-align: right;
      font-size: 16px;
      background-color: purple;
      color: yellow;
    }
  10. 10.🎯 Which CSS selector matches this element?
    <div class="star" id="intro">Hello</div>
    (a) span (b) .menu (c) div (d) #star
  11. 11.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 15px;
      border: 3px solid black;
      margin: 5px;
    }
  12. 12.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 20px;
      color: green;
      background-color: yellow;
      text-align: left;
    }
    (a) on the left (b) on the right (c) in the middle
  13. 13.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) 600px or wider (c) exactly 1000px (d) turned off
  14. 14.🎯 Which CSS selector matches this element?
    <span class="box" id="end">Hello</span>
    (a) .star (b) #box (c) p (d) .box
  15. 15.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 240px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  17. 17.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) align-items (d) justify-content
  18. 18.✍️ What value is given to padding in this rule?
    p {
      padding: 8px;
      font-style: italic;
      color: red;
      font-weight: bold;
    }
    (a) padding (b) bold (c) 2px solid (d) 8px
  19. 19.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  21. 21.🖌️ What colour are the letters?
    h2 {
      font-size: 16px;
      background-color: yellow;
      text-align: right;
      color: green;
    }
    (a) yellow (b) white (c) green
  22. 22.Which of these does CSS do? (a) sets colours and fonts (b) makes headings and lists (c) makes a form box (d) changes the page live
  23. 23.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    #hero { color: blue; }
    #hero { color: purple; }
    (a) blue (b) white (c) orange (d) purple
  24. 24.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    #intro { color: white; }
    #intro { color: orange; }
    (a) blue (b) white (c) orange (d) red
  25. 25.🌈 Which colour is rgb(0, 0, 0)? (a) yellow (b) black (c) bright green (d) cyan
  26. 26.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    #logo { color: red; }
    .star { color: blue; }
    p { color: yellow; }
    (a) red (b) white (c) yellow (d) blue
  27. 27.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  28. 28.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  29. 29.Which of these does HTML do? (a) shows a pop-up message (b) puts a picture on a page (c) rounds box corners (d) changes the page live
  30. 30.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 24px;
      color: red;
      text-align: center;
      background-color: yellow;
    }
    (a) in the middle (b) on the right (c) on the left
  31. 31.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
  32. 32.🖌️ Where does the text sit on its line?
    p {
      color: purple;
      text-align: left;
      font-size: 16px;
      background-color: blue;
    }
    (a) on the right (b) in the middle (c) on the left
  33. 33.What does font-weight do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) picks the font style
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  35. 35.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      background-color: yellow;
      color: red;
    }
  37. 37.🌈 Which colour is #ffff00? (a) white (b) yellow (c) red (d) magenta
  38. 38.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) picks the font style
  39. 39.🖌️ What colour is behind the letters?
    h1 {
      background-color: black;
      text-align: left;
      font-size: 16px;
      color: white;
    }
    (a) green (b) white (c) black
  40. 40.🎯 Which element does the selector #main style? (a) <p class="main"> (b) <p id="main"> (c) <p id="logo"> (d) <h1 class="big">

Answer key

  1. white
  2. changes the text size
  3. red
  4. #0000ff
  5. 255
  6. 162
  7. 2
  8. red
  9. 16
  10. div
  11. 176
  12. on the left
  13. 600px or narrower
  14. .box
  15. equal gaps, none at ends
  16. 308
  17. flex-direction
  18. 8px
  19. an element selector
  20. 50
  21. green
  22. sets colours and fonts
  23. purple
  24. orange
  25. black
  26. red
  27. 16
  28. CSS
  29. puts a picture on a page
  30. in the middle
  31. a class selector
  32. on the left
  33. makes the text bold
  34. 70
  35. 10
  36. 3
  37. yellow
  38. makes letters bigger
  39. black
  40. <p id="main">

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