← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 911 · 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 colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    .big { color: purple; }
    .big { color: black; }
    (a) purple (b) red (c) yellow (d) black
  2. 2.✍️ What is the selector in this CSS rule?
    .note {
      font-weight: bold;
      padding: 8px;
      background-color: yellow;
      color: red;
    }
    (a) font-weight (b) 8px (c) .note (d) #top
  3. 3.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) ( ) (d) { }
  4. 4.🖌️ Where does the text sit on its line?
    p {
      background-color: purple;
      text-align: right;
      font-size: 12px;
      color: black;
    }
    (a) in the middle (b) on the right (c) on the left
  5. 5.True or false: margin is space inside the border. (a) True (b) False
  6. 6.🎯 Can many elements share the same class? (a) No (b) Yes
  7. 7.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
  8. 8.🌈 Which colour is #ff00ff? (a) blue (b) black (c) white (d) magenta
  9. 9.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) white (c) blue (d) red
  10. 10.🌈 Which colour is #00ffff? (a) black (b) red (c) blue (d) cyan
  11. 11.🎯 What kind of selector is .card? (a) an element selector (b) an id selector (c) a class selector
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: red; }
    (a) red (b) black (c) green (d) purple
  13. 13.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
  14. 14.🎯 Which CSS selector matches this element?
    <div class="star" id="intro">Hello</div>
    (a) div (b) span (c) .intro (d) #star
  15. 15.True or false: the content is space inside the border. (a) True (b) False
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  17. 17.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) magenta (d) red
  18. 18.🎯 Which element does the selector .red style? (a) <h1 class="box"> (b) <h1 id="red"> (c) <h2 class="star"> (d) <h1 class="red">
  19. 19.📦 In the box model, which part is the line round the box? (a) content (b) border (c) padding (d) margin
  20. 20.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 90px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  21. 21.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  22. 22.🖌️ What colour is behind the letters?
    p {
      background-color: orange;
      color: black;
      text-align: left;
      font-size: 12px;
    }
    (a) orange (b) black (c) red
  23. 23.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) adds space around boxes (d) puts a picture on a page
  24. 24.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  25. 25.🖌️ How big is the text, in px?
    p {
      font-size: 24px;
      background-color: purple;
      color: orange;
      text-align: left;
    }
  26. 26.✍️ Which property is set to 300px in this rule?
    .box {
      font-size: 20px;
      font-weight: bold;
      background-color: yellow;
      width: 300px;
    }
    (a) color (b) font-style (c) width (d) 300px
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  28. 28.📦 In the box model, which part is a solid or dotted edge? (a) border (b) margin (c) content (d) padding
  29. 29.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
  30. 30.True or false: CSS rounds box corners. (a) True (b) False
  31. 31.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 20px;
      border: 3px solid black;
      margin: 20px;
    }
  32. 32.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) blue (d) green
  33. 33.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  34. 34.True or false: #main is an id selector. (a) True (b) False
  35. 35.🖌️ What colour is behind the letters?
    h1 {
      font-size: 16px;
      color: red;
      text-align: right;
      background-color: black;
    }
    (a) black (b) green (c) red
  36. 36.✍️ What is the selector in this CSS rule?
    h1 {
      text-align: center;
      color: red;
    }
    (a) red (b) text-align (c) p (d) h1
  37. 37.🌈 In #690000 the red part is the hex number 69. What is it as a normal number?
  38. 38.Which of these is the content? (a) space inside the border (b) the line round the box (c) the text or picture (d) the gap to other boxes
  39. 39.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  40. 40.💪 Which flexbox property turns on flexbox? (a) align-items (b) gap (c) justify-content (d) display: flex

Answer key

  1. black
  2. .note
  3. { }
  4. on the right
  5. False
  6. Yes
  7. fits every screen
  8. magenta
  9. blue
  10. cyan
  11. a class selector
  12. red
  13. 800px or wider
  14. div
  15. False
  16. 340
  17. blue
  18. <h1 class="red">
  19. border
  20. 10
  21. 6
  22. orange
  23. puts a picture on a page
  24. HTML
  25. 24
  26. width
  27. 10
  28. border
  29. .css
  30. True
  31. 196
  32. blue
  33. an element selector
  34. True
  35. black
  36. h1
  37. 105
  38. the text or picture
  39. CSS
  40. display: flex

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