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

Answer key

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

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