+ 1

Can anyone tell me the difference between id and class selectors in CSS with an example?

Tried making out the difference practically but both worked out the same for me.

27th Aug 2018, 3:22 PM
Tanish Kushwaha
Tanish Kushwaha - avatar
3 Réponses
0
A previous discussion on the same subject: https://www.sololearn.com/Discuss/759805/?ref=app
27th Aug 2018, 11:02 PM
Ipang
+ 2
Tanish Kushwaha you can access with id and class but major difference between id and class is class you can use to multiple HTML tags but id could only be used with one element (tag) (id is always unique like your id card , your gmail id, Facebook id etc.)
28th Aug 2018, 1:53 AM
Amir Ahmad
Amir Ahmad - avatar
+ 1
One more difference between id and class is when u put both in an element and there are conflicting with each other then id will be taken final decision. How cool is it.
2nd Sep 2018, 8:26 AM
Dushyant Narula