What is the difference between the id and class attributes in HTML?
The id attribute identifies an element with a document-wide identifier, while class assigns one or more reusable class names. CSS and JavaScript can use both, but classes are normally preferred for reusable styling.