Class: Class is an attribute that defines a group of HTML elements to apply unique styling and formatting to those elements. class is not unique and has multiple elements. Class is selector used to Hash symbol(#).Class attribute is accessed with document.getElementById().
ID: The id selectors style the element with the specified id.ID is unique and it can be assigned to a single element. ID is selector used to period or dot(.).ID attribute is accessed with document.getElementsByClassName().
Top comments (0)