← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 681 · 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?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    #end { color: yellow; }
    #end { color: orange; }
    (a) orange (b) black (c) green (d) yellow
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  3. 3.True or false: #main is a class selector. (a) False (b) True
  4. 4.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 280px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  5. 5.🎯 Which CSS selector matches this element?
    <div class="note" id="intro">Hello</div>
    (a) #note (b) span (c) div (d) #main
  6. 6.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    .red { color: red; }
    .red { color: blue; }
    (a) blue (b) white (c) red (d) black
  7. 7.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  8. 8.🎯 Can many elements share the same class? (a) No (b) Yes
  9. 9.🌈 Which hex code is white? (a) #ffff00 (b) #0000ff (c) #ffffff (d) #ff0000
  10. 10.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the viewport meta tag (d) the br tag
  11. 11.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) gap (d) display: flex
  12. 12.🌈 Which colour is #ff00ff? (a) magenta (b) bright green (c) blue (d) cyan
  13. 13.🌈 Which colour is #00ff00? (a) blue (b) cyan (c) bright green (d) magenta
  14. 14.✍️ Which property is set to 8px in this rule?
    p {
      padding: 8px;
      border: 2px solid;
    }
    (a) 8px (b) font-weight (c) padding (d) border
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    .big { color: yellow; }
    (a) red (b) white (c) yellow (d) black
  16. 16.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  17. 17.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 380px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  18. 18.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 300px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  19. 19.True or false: .star is a class selector. (a) False (b) True
  20. 20.True or false: .card is an element selector. (a) True (b) False
  21. 21.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
  22. 22.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
  23. 23.🌈 Which hex code is blue? (a) #000000 (b) #ffff00 (c) #ffffff (d) #0000ff
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="note" id="hero">Hi</h2>
    CSS:
    h2 { color: white; }
    h2 { color: yellow; }
    (a) red (b) yellow (c) green (d) white
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 240px;
      padding: 20px;
      border: 5px solid black;
      margin: 20px;
    }
  26. 26.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  27. 27.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  28. 28.🖌️ What colour is behind the letters?
    h2 {
      text-align: left;
      background-color: red;
      color: white;
      font-size: 32px;
    }
    (a) white (b) black (c) red
  29. 29.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) justify-content (c) display: flex (d) gap
  30. 30.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) changes the page live (d) counts down a timer
  31. 31.Which of these does CSS do? (a) sets colours and fonts (b) counts down a timer (c) changes the page live (d) makes headings and lists
  32. 32.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
  33. 33.Which of these does CSS do? (a) reacts to a button click (b) rounds box corners (c) makes a link (d) shows a pop-up message
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      background-color: yellow;
      font-style: italic;
    }
  35. 35.True or false: h1 is an element selector. (a) False (b) True
  36. 36.True or false: the border is a solid or dotted edge. (a) False (b) True
  37. 37.✍️ What is the selector in this CSS rule?
    h2 {
      text-align: center;
      padding: 8px;
      margin: 10px;
      font-style: italic;
    }
    (a) h2 (b) 8px (c) h1 (d) text-align
  38. 38.✍️ What is the selector in this CSS rule?
    p {
      width: 300px;
      color: red;
    }
    (a) width (b) .note (c) p (d) red
  39. 39.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) ( ) (d) { }
  40. 40.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }

Answer key

  1. orange
  2. 10
  3. False
  4. 40
  5. div
  6. blue
  7. 800px or wider
  8. Yes
  9. #ffffff
  10. the viewport meta tag
  11. flex-direction
  12. magenta
  13. bright green
  14. padding
  15. black
  16. No
  17. 20
  18. 60
  19. True
  20. False
  21. JavaScript
  22. :
  23. #0000ff
  24. yellow
  25. 330
  26. CSS
  27. 600px or narrower
  28. red
  29. display: flex
  30. makes headings and lists
  31. sets colours and fonts
  32. fits every screen
  33. rounds box corners
  34. 3
  35. True
  36. True
  37. h2
  38. p
  39. { }
  40. 18

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