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

Answer key

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

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