You are tasked with creating a list where every even item has a gray background. Which CSS selector would help you accomplish this?

  • :even
  • :nth-child(even)
  • :nth-child(odd)
  • :odd
To select every even item in a list, you should use the :nth-child(even) selector. This will apply the styling to the elements with even indices in the list, which will give them a gray background in this scenario.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *