What is the difference between CLASS and ID attributes? The CLASS attribute names a set (class) of elements that a particular element instance belongs to. The practical use of CLASS is currently in conjunction with style sheets, where you can then specify (using e. g. an selector) that some rules are to be applied to The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a # . Id is unique to every element and would be specific to that element. While the class selector is used to specify a style for a group of elements. You can use the same class to different elements which means you can apply few properties An element can have multiple classes and multiple elements can have the same class, however, only one element can have a specific ID. (If you define multiple elements with the same ID html id class difference Any element can have a class or an id. A class is used to reference a certain type of display, for example you may have a css class for a div that represents the answer to this question. As there will be many answers, multiple divs would need the same styling and you would use a class. The# means that it matches the id of an element. The. signifies the class name: Note that in a HTML document, the id attribute must be unique, so if you have more than one element needing a specific style, you should use a class name. The dot(. ) signifies a class name while the hash (# ) signifies an element with a specific id attribute. # ID's and Classes are hooks We need ways to describe content in an HTMLXHTML document. The basic elements like, , and will often do the job, but our How can the answer be improved?