← Selectors: element, class and id lesson New set →

CSS Worksheet: Selectors Class and Id

HTML and CSS lesson 13: Selectors: element, class and id · Set 735 · 40 questions
TalentJR

Code tip (Dot for class, hash for id): p matches every <p>; .note matches class="note"; #top matches id="top". A dot means class, a hash means id — mixing them up matches nothing. Many elements can share a class; an id belongs to only one element.

NameDateTime takenScore ___ / 40
  1. 1.🎯 Which CSS selector matches this element?
    <li class="red" id="top">Hello</li>
    (a) li (b) .top (c) #intro (d) #red
  2. 2.🎯 Which CSS selector matches this element?
    <span class="big" id="end">Hello</span>
    (a) .end (b) #big (c) #end (d) .red
  3. 3.🎯 Which element does the selector div style? (a) <h1 id="logo"> (b) <span> (c) <p class="big"> (d) <div class="big">
  4. 4.🎯 Which sign starts an id selector? (a) . (b) & (c) @ (d) #
  5. 5.🎯 Which CSS selector matches this element?
    <p class="star" id="end">Hello</p>
    (a) .menu (b) #star (c) .end (d) .star
  6. 6.🎯 Which CSS selector matches this element?
    <div class="star" id="top">Hello</div>
    (a) .menu (b) #intro (c) div (d) span
  7. 7.🎯 Which CSS selector matches this element?
    <div class="red" id="end">Hello</div>
    (a) .box (b) #hero (c) #red (d) div
  8. 8.🎯 Which CSS selector matches this element?
    <span class="note" id="top">Hello</span>
    (a) #intro (b) .top (c) .note (d) .big
  9. 9.🎯 Which CSS selector matches this element?
    <li class="star" id="hero">Hello</li>
    (a) #star (b) #hero (c) #top (d) div
  10. 10.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
  11. 11.🎯 Which CSS selector matches this element?
    <h1 class="red" id="main">Hello</h1>
    (a) h2 (b) #main (c) #red (d) .box
  12. 12.🎯 What kind of selector is body? (a) an id selector (b) an element selector (c) a class selector
  13. 13.🎯 What kind of selector is .note? (a) an id selector (b) a class selector (c) an element selector
  14. 14.True or false: #end is an id selector. (a) False (b) True
  15. 15.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
  16. 16.🎯 Which element does the selector h1 style? (a) <h2> (b) <h1 class="star"> (c) <li class="star"> (d) <div id="hero">
  17. 17.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 5 (d) 2
  18. 18.🎯 Which CSS selector matches this element?
    <div class="box" id="logo">Hello</div>
    (a) span (b) #box (c) .star (d) .box
  19. 19.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) span (b) #box (c) .intro (d) #intro
  20. 20.True or false: #hero is a class selector. (a) True (b) False
  21. 21.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
  22. 22.🎯 Which CSS selector matches this element?
    <div class="star" id="main">Hello</div>
    (a) #main (b) .menu (c) #star (d) #logo
  23. 23.True or false: body is an id selector. (a) False (b) True
  24. 24.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
  25. 25.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
  26. 26.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
  27. 27.🎯 Which element does the selector span style? (a) <h1 class="box"> (b) <p> (c) <h2 id="top"> (d) <span class="box">
  28. 28.🎯 Which element does the selector .menu style? (a) <p class="note"> (b) <h1 class="big"> (c) <p class="menu"> (d) <p id="menu">
  29. 29.🎯 What kind of selector is img? (a) a class selector (b) an element selector (c) an id selector
  30. 30.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  31. 31.🎯 Which CSS selector matches this element?
    <li class="note" id="hero">Hello</li>
    (a) .hero (b) #top (c) li (d) #note
  32. 32.🎯 Which element does the selector #top style? (a) <div class="top"> (b) <span class="big"> (c) <div id="top"> (d) <div id="intro">
  33. 33.🎯 Which element does the selector #main style? (a) <h1 class="big"> (b) <p id="main"> (c) <p id="logo"> (d) <p class="main">
  34. 34.🎯 Which CSS selector matches this element?
    <li class="note" id="intro">Hello</li>
    (a) .intro (b) .big (c) div (d) .note
  35. 35.🎯 Which element does the selector .big style? (a) <span class="big"> (b) <span id="big"> (c) <p class="box"> (d) <span class="red">
  36. 36.🎯 Which element does the selector .note style? (a) <div class="red"> (b) <li class="note"> (c) <li class="big"> (d) <li id="note">
  37. 37.🎯 Can many elements share the same class? (a) Yes (b) No
  38. 38.🎯 Which element does the selector #top style? (a) <h1 class="top"> (b) <h2 class="menu"> (c) <h1 id="top"> (d) <h1 id="intro">
  39. 39.🎯 Which element does the selector #top style? (a) <span id="top"> (b) <span class="top"> (c) <span id="intro"> (d) <p class="menu">
  40. 40.🎯 Which element does the selector #intro style? (a) <h2 class="big"> (b) <h1 class="intro"> (c) <h1 id="main"> (d) <h1 id="intro">

Answer key

  1. li
  2. #end
  3. <div class="big">
  4. #
  5. .star
  6. div
  7. div
  8. .note
  9. #hero
  10. an id selector
  11. #main
  12. an element selector
  13. a class selector
  14. True
  15. a class selector
  16. <h1 class="star">
  17. 1
  18. .box
  19. #intro
  20. False
  21. .
  22. #main
  23. False
  24. a class selector
  25. an id selector
  26. an id selector
  27. <span class="box">
  28. <p class="menu">
  29. an element selector
  30. an element selector
  31. li
  32. <div id="top">
  33. <p id="main">
  34. .note
  35. <span class="big">
  36. <li class="note">
  37. Yes
  38. <h1 id="top">
  39. <span id="top">
  40. <h1 id="intro">

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