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

Answer key

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

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