What is the difference between classes and IDs in CSS?

Technology CommunityCategory: CSSWhat is the difference between classes and IDs in CSS?
VietMX Staff asked 3 years ago
  • 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.