HTML Class and Id
By Saket Bhatnagar••Beginner to Intermediate
class and id
- 1class and id both are attributes in HTML and are used to target the elements in a web page.
- 2'class' is used to target multiple elements whereas 'id' is used to uniquely identify the element.
- 3One element can have multiple classes whereas one element should have only one id.
- 4We can apply same class to multiple elements whereas id should be unique in a webpage and should not be applied to multiple elements.
- 5Sytax :- class = 'c1, c2,c3,-----,cn' whereas id = 'id1'