I dont understand. whats the difference between class and id they both exibits same properties. What class makes differ from id? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I dont understand. whats the difference between class and id they both exibits same properties. What class makes differ from id?

23rd Feb 2018, 4:30 AM
Ashok Stp
Ashok Stp - avatar
7 Answers
+ 2
than you
23rd Feb 2018, 4:43 AM
Ashok Stp
Ashok Stp - avatar
+ 2
Well, ID is unique and Class isn't. You can call a lot of classes with the same function. I think that is it.
26th Feb 2018, 4:27 AM
Hélio Pinheiro
Hélio Pinheiro - avatar
+ 1
ID can be used in CSS, but it's more of a fiture of Java Script. Usually we use classes for CSS and IDs for JS
25th Feb 2018, 9:06 PM
Matthias Bond
0
Different elements in html can have the same class. But id is used to uniquely identify an element.
9th Mar 2018, 2:52 PM
Isaac Sarfo Boateng
Isaac Sarfo Boateng - avatar
14th Jul 2018, 5:21 PM
Karina Bowman
Karina Bowman - avatar
- 1
generally classes are used for styling, thus several parts may have same styles, and id is used for JavaScript actions and, in css styling id has greater priority than class
25th Feb 2018, 6:15 AM
Munarbek Aitiev
- 1
pinherio, yeah! that's called auto increment:)
28th Feb 2018, 1:30 PM
Matthias Bond