Class, ID difference

liunx

Guest
What are the main differences between classes and ids? The concept confuses me a little?Here is how I remember it.

You have a class of history students. There are multiple history students, therefore, you would have multiple times where you would use a specific entry in CSS. Classes are more generic, and can be re-used.

IDs are unique - you use them only once throughout the html page.

I'm pretty sure I'm saying it right, but if I'm not someone else will correct me, I'm sure :)That's right. Another example would be the group of people we call "middle class". Every person in that group has a characteristic that is represented by that "class". Each person has an ID (drivers license, SSN, passport) that identifies that specific person.

"Class" - multiple
"Identity" - singlular
 
Back
Top