+ 1

what is the Difference between class and ID

it always make me confuse is there any easy way to understand them ???

19th Dec 2016, 6:10 AM
Pawan Smy
Pawan Smy - avatar
2 ответов
+ 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.
19th Dec 2016, 6:29 AM
Antek
+ 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!
31st Dec 2016, 5:37 PM
Dwij Jha
Dwij Jha - avatar