← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 333 · 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 are the letters?
    li {
      text-align: left;
      color: yellow;
      font-size: 32px;
      background-color: orange;
    }
    (a) orange (b) black (c) yellow
  2. 2.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) background-color (d) font-weight
  3. 3.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  4. 4.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
  5. 5.True or false: CSS changes the page live. (a) True (b) False
  6. 6.Which of these does CSS do? (a) changes the text size (b) counts down a timer (c) reacts to a button click (d) gives the page structure
  7. 7.True or false: JavaScript makes headings and lists. (a) True (b) False
  8. 8.✍️ What value is given to border in this rule?
    li {
      border: 2px solid;
      text-align: center;
      padding: 8px;
    }
    (a) 300px (b) 2px solid (c) italic (d) border
  9. 9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  10. 10.🎯 Which CSS selector matches this element?
    <li class="note" id="top">Hello</li>
    (a) .note (b) div (c) #note (d) #intro
  11. 11.🧩 Which language puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  12. 12.✍️ What value is given to background-color in this rule?
    h1 {
      width: 300px;
      background-color: yellow;
    }
    (a) background-color (b) 8px (c) yellow (d) 10px
  13. 13.What does font-family do? (a) makes letters bigger (b) picks the font style (c) colours behind the text (d) sets the letter colour
  14. 14.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) changes the text size (d) puts a picture on a page
  15. 15.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
  16. 16.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  17. 17.✍️ Which property is set to bold in this rule?
    h1 {
      font-style: italic;
      text-align: center;
      font-weight: bold;
    }
    (a) width (b) border (c) font-weight (d) bold
  18. 18.True or false: h1 is a class selector. (a) True (b) False
  19. 19.✍️ What is the selector in this CSS rule?
    p {
      padding: 8px;
      color: red;
      text-align: center;
    }
    (a) .note (b) padding (c) p (d) red
  20. 20.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) alt (d) href
  21. 21.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) green (b) red (c) blue (d) purple
  22. 22.🌈 Which colour of light is strongest in rgb(131, 212, 85)? (a) green (b) red (c) blue
  23. 23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 60px;
      padding: 25px;
      border: 3px solid black;
      margin: 0px;
    }
  24. 24.🖌️ What colour are the letters?
    li {
      color: blue;
      font-size: 32px;
      text-align: left;
      background-color: white;
    }
    (a) black (b) white (c) blue
  25. 25.✍️ In color: blue; which part is the value? (a) blue (b) color (c) ; (d) :
  26. 26.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    .menu { color: purple; }
    #top { color: black; }
    (a) purple (b) red (c) blue (d) black
  27. 27.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
  28. 28.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  29. 29.🖌️ Which CSS property makes letters bigger? (a) color (b) font-weight (c) background-color (d) font-size
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 10px;
      border: 4px solid black;
      margin: 5px;
    }
  31. 31.🎯 Which CSS selector matches this element?
    <h2 class="red" id="hero">Hello</h2>
    (a) #red (b) .hero (c) #top (d) h2
  32. 32.What does justify-content: space-between do? (a) packs boxes at the end (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the start
  33. 33.🎯 Which CSS selector matches this element?
    <span class="box" id="top">Hello</span>
    (a) #box (b) .star (c) span (d) #intro
  34. 34.✍️ Which property is set to 20px in this rule?
    .note {
      background-color: yellow;
      font-size: 20px;
    }
    (a) background-color (b) font-size (c) 20px (d) text-align
  35. 35.Which of these does CSS do? (a) adds space around boxes (b) checks a quiz answer (c) makes a form box (d) gives the page structure
  36. 36.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
  37. 37.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  38. 38.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) display: flex (d) gap
  39. 39.🌈 Which colour of light is strongest in rgb(179, 15, 82)? (a) green (b) blue (c) red
  40. 40.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }

Answer key

  1. yellow
  2. font-family
  3. an id selector
  4. { }
  5. False
  6. changes the text size
  7. False
  8. 2px solid
  9. 20
  10. .note
  11. HTML
  12. yellow
  13. picks the font style
  14. changes the text size
  15. fits every screen
  16. Yes
  17. font-weight
  18. False
  19. p
  20. style
  21. purple
  22. green
  23. 116
  24. blue
  25. blue
  26. black
  27. 12
  28. 312
  29. font-size
  30. 128
  31. h2
  32. equal gaps, none at ends
  33. span
  34. font-size
  35. adds space around boxes
  36. Cascading Style Sheets
  37. the viewport meta tag
  38. flex-direction
  39. red
  40. 12

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