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

Answer key

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

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