I know for id we have to use '#' symbol & for class '.' symbol. But i dont know what class does & id does i use both for styling css. Can any one help me when i want to use id & when class.is there is any major difference.
Asked
Active
Viewed 1,035 times
-5
-
buddy, welcome to stackoverflow, but this is not the right question to ask here google and read this https://css-tricks.com/the-difference-between-id-and-class/ – Awsme Sandy Sep 12 '17 at 09:23
-
CSS Tricks has a nice article about this https://css-tricks.com/the-difference-between-id-and-class/ – phuzi Sep 12 '17 at 09:23
2 Answers
1
ID's are unique
- Each element can have only one ID
- Each page can have only one element with that ID
Classes are NOT unique
You can use the same class on multiple elements.
You can use multiple classes on the same element.

roshan_nazareth
- 311
- 5
- 16
0
The id is an identifiant which is supposed to be unique amongst its siblings.
The class is not related to uniqueness.

Vincent Cantin
- 16,192
- 2
- 35
- 57