← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 299 · 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) an element selector (b) an id selector (c) a class selector
  2. 2.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  3. 3.🖌️ Where does the text sit on its line?
    li {
      color: green;
      text-align: right;
      background-color: red;
      font-size: 40px;
    }
    (a) on the right (b) in the middle (c) on the left
  4. 4.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
  5. 5.🎯 Which CSS selector matches this element?
    <span class="menu" id="logo">Hello</span>
    (a) #logo (b) .note (c) p (d) .logo
  6. 6.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Computer Style Sheets
  7. 7.🌈 Which hex code is black? (a) #000000 (b) #00ffff (c) #ff0000 (d) #ffff00
  8. 8.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
  9. 9.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  10. 10.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    .star { color: blue; }
    #hero { color: orange; }
    (a) blue (b) black (c) green (d) orange
  11. 11.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue
  12. 12.✍️ What is the selector in this CSS rule?
    li {
      font-size: 20px;
      font-weight: bold;
    }
    (a) body (b) li (c) bold (d) font-size
  13. 13.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  14. 14.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) black (c) bright green (d) red
  15. 15.What does justify-content: space-between do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  16. 16.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) cyan (c) blue (d) magenta
  17. 17.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  18. 18.🖌️ Where does the text sit on its line?
    li {
      background-color: green;
      color: yellow;
      font-size: 32px;
      text-align: right;
    }
    (a) on the right (b) in the middle (c) on the left
  19. 19.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) blue (d) red
  20. 20.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  21. 21.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
  22. 22.🌈 Which colour of light is strongest in rgb(137, 205, 123)? (a) green (b) blue (c) red
  23. 23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  24. 24.💪 Which flexbox property sets space between boxes? (a) gap (b) align-items (c) display: flex (d) flex-direction
  25. 25.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
  26. 26.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="logo">Hello</h2>
    (a) li (b) h2 (c) #menu (d) .note
  27. 27.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .js (d) .html
  28. 28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  29. 29.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
  30. 30.True or false: img is an element selector. (a) True (b) False
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
      border: 2px solid;
      padding: 8px;
    }
  32. 32.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  33. 33.What does background-color do? (a) sets the letter colour (b) makes the text bold (c) picks the font style (d) colours behind the text
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  35. 35.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) G (d) F
  36. 36.Which of these is margin? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) space outside the border
  37. 37.🌈 Which colour is #ff0000? (a) red (b) cyan (c) blue (d) black
  38. 38.🎯 Which CSS selector matches this element?
    <div class="red" id="intro">Hello</div>
    (a) span (b) div (c) #main (d) .box
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .note { color: black; }
    (a) red (b) white (c) black (d) yellow
  40. 40.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) magenta (c) yellow (d) cyan

Answer key

  1. an id selector
  2. Yes
  3. on the right
  4. 6
  5. #logo
  6. Cascading Style Sheets
  7. #000000
  8. the viewport meta tag
  9. an element selector
  10. orange
  11. color
  12. li
  13. JavaScript
  14. red
  15. equal gaps, none at ends
  16. blue
  17. No
  18. on the right
  19. red
  20. 24
  21. space-between
  22. green
  23. 12
  24. gap
  25. padding
  26. h2
  27. .css
  28. 24
  29. fits every screen
  30. True
  31. 3
  32. 10
  33. colours behind the text
  34. 20
  35. F
  36. space outside the border
  37. red
  38. div
  39. black
  40. cyan

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