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.

Related questions

0 votes
asked Aug 17, 2020 in HTML by RShastri (1.7k points)
0 votes
asked Aug 17, 2020 in HTML by RShastri (1.7k points)
+1 vote
asked Aug 17, 2020 in HTML by RShastri (1.7k points)
+1 vote
asked Aug 17, 2020 in HTML by RShastri (1.7k points)
0 votes
asked Nov 20, 2020 in JQuery by sharadyadav1986 (31.7k points)
0 votes
asked Jan 5, 2021 in HTML by SakshiSharma (32.2k points)
...