+ 1
what is the Difference between class and ID
it always make me confuse is there any easy way to understand them ???
2 Answers
+ 6
Yes, there is a simple way: ID is a unique identifier so each ID name should exist only once per page, while each class name can be used as many times as necessary. This way you can easily create a style that applies to one individual element only, or a style that can easily apply to multiple elements at the same time. An element can only have one ID, but can have multiple class references. Also an element can have both an ID and classes.
+ 2
As an example :- if you are a boy you have the class:boy but your id is unique and no other boy can have the same id!