+1 vote
in HTML by (1.7k points)
What is the difference between classes and IDs in CSS?

1 Answer

0 votes
by (1.7k points)
  • IDs — Meant to be unique within the document. Can be used to identify an element when linking using a fragment identifier. Elements can only have one id attribute.

  • Classes — Can be reused on multiple elements within the document. Mainly for styling and targeting elements.