Jump to content

Class/ID


Krewe
 Share

Recommended Posts

Kind of a lame question but I figure I need clarification.What is the difference between using a class identifier or ID?I have been using ID for all my Divs. Is that wrong?Thanks guys :)~Krewe

Link to comment
Share on other sites

Yap, it is wrong to use a particular #id for more than one element. Id is suppose to be unique! u can assign more than one element to a class because a class is like a group. Wen you assign 5 elements to a group, the 5 element will belong to that group, but id is just an idententity to one particular element. Let me use you for example. You can belong to a group, which is called MALE and other guys can also belong to the same group becouse you are not the only male around, but your identity (e.g the way u talk, your colour, your eye color, the way you talk, walk, etc), only belongs to you and somebody else cannot have everything you have, there must be a little diffrence.

Link to comment
Share on other sites

The reason you are unique, its because you have your own identity(id), but you belong to a class (humans) and you can also belong to another class (those who play football) if you wish. You can give more than one element a particular id, it will WORK, but its wrong, because its not supposed to be so. I can't have your identity, but if i wish to have it, i can do a Surgery, and i ll have it, but its wrong and its not supposed to be so. Hope this helped in a little way?

Edited by O. Samuel
Link to comment
Share on other sites

:)um, I'll just let the tutorials do the explanation. http://www.w3schools.com/css/css_id_class.aspPretty simple though. Use and ID once on a page to uniquely target an element. To target multiple elements, use a class.

Link to comment
Share on other sites

I like Samuel's explanation better!Thanks you two, I was reading some threads and this came up and I thought **** :).Might be why I had some issues.~Krewe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...