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

Answer key

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

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