What is the difference?


what is the difference between the attributes id and class?


To start with, id has higher specificity (importance) than class.

An id attribute value can only be used once in the document. It can be written on any element. Likewise, class can be written on any element but unlike id it can apply to any number of elements, or types.

This question came up yesterday, so take a look at that topic…

id vs class


thanks now i understand


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.