← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 574 · 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 element does the selector .note style? (a) <h1 class="red"> (b) <p class="note"> (c) <p id="note"> (d) <p class="big">
  2. 2.🎯 What kind of selector is h1? (a) an element selector (b) an id selector (c) a class selector
  3. 3.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) green (d) blue
  4. 4.🎯 Which element does the selector .big style? (a) <p class="big"> (b) <h1 class="box"> (c) <p class="red"> (d) <p id="big">
  5. 5.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  6. 6.Which of these does JavaScript do? (a) rounds box corners (b) gives the page structure (c) adds space around boxes (d) reacts to a button click
  7. 7.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
  8. 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  9. 9.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 410px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  11. 11.🌈 Which colour is #00ff00? (a) white (b) red (c) cyan (d) bright green
  12. 12.🎯 What kind of selector is #end? (a) a class selector (b) an element selector (c) an id selector
  13. 13.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) checks a quiz answer (d) lays out the page
  14. 14.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  15. 15.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 2px solid black;
      margin: 15px;
    }
  17. 17.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
  18. 18.What does font-family do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) centres a heading
  19. 19.🎯 Which CSS selector matches this element?
    <h1 class="red" id="logo">Hello</h1>
    (a) .logo (b) #red (c) h2 (d) h1
  20. 20.🌈 Which hex code is bright green? (a) #ff0000 (b) #00ffff (c) #00ff00 (d) #0000ff
  21. 21.🖌️ What colour are the letters?
    li {
      color: purple;
      font-size: 32px;
      text-align: left;
      background-color: white;
    }
    (a) white (b) orange (c) purple
  22. 22.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  23. 23.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  24. 24.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
  25. 25.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) flex-end (d) center
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    .box { color: orange; }
    #end { color: black; }
    (a) black (b) purple (c) blue (d) orange
  27. 27.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) magenta (c) black (d) cyan
  28. 28.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  29. 29.✍️ What value is given to background-color in this rule?
    #top {
      color: red;
      width: 300px;
      background-color: yellow;
    }
    (a) yellow (b) 8px (c) 10px (d) background-color
  30. 30.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS
  31. 31.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  32. 32.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  34. 34.🌈 Which colour is #ffff00? (a) blue (b) yellow (c) black (d) magenta
  35. 35.🖌️ Which CSS property picks the font style? (a) color (b) font-size (c) background-color (d) font-family
  36. 36.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) makes a form box (d) puts a picture on a page
  37. 37.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  38. 38.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
  39. 39.🎯 Which CSS selector matches this element?
    <h2 class="note" id="end">Hello</h2>
    (a) #hero (b) .note (c) li (d) #note
  40. 40.True or false: the border is a solid or dotted edge. (a) False (b) True

Answer key

  1. <p class="note">
  2. an element selector
  3. red
  4. <p class="big">
  5. Yes
  6. reacts to a button click
  7. padding
  8. the later one
  9. Yes
  10. 10
  11. bright green
  12. an id selector
  13. lays out the page
  14. { }
  15. a class selector
  16. 144
  17. ;
  18. picks the font style
  19. h1
  20. #00ff00
  21. purple
  22. equal gaps, none at ends
  23. an element selector
  24. /*
  25. flex-end
  26. black
  27. magenta
  28. many pages
  29. yellow
  30. JavaScript
  31. 14
  32. No
  33. 96
  34. yellow
  35. font-family
  36. reacts to a button click
  37. Yes
  38. 24
  39. .note
  40. True

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