Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 What is the difference between Class and ID?
Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HazySmoke)345




PostPosted: Fri Feb 09, 2007 12:29 am   Post subject: What is the difference between Class and ID?

All HTML tags can accept attributes "class" and "id", but what is the difference between them?

I've been reading a book an HTML, and this book doesn't do a good job on explaining the difference. In fact, it seems to me that the author uses them interchangably.

Is there a difference?
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Fri Feb 09, 2007 1:02 am   Post subject: RE:What is the difference between Class and ID?

There is a huge difference. An id identifies a particular tag, gives it a name that can be used by scripts, CSS, etc. to refer to that specific tag (or potentially all identically named tags). Classes are a CSS construct which allow you to specify CSS attributes, they in no way identify a tag or a set of tags.
rdrake




PostPosted: Fri Feb 09, 2007 8:32 am   Post subject: RE:What is the difference between Class and ID?

Basically like md said, the id tag is used to identify usually just one element. The class tag is usually used to identify multiple elements.

So if you want to apply CSS to one single element, you'd use id, otherwise to apply it to multiple elements, use class.
HazySmoke)345




PostPosted: Fri Feb 09, 2007 10:20 pm   Post subject: Re: What is the difference between Class and ID?

Thanks guys. I've given each of you some bits. I can't give too many though Sad I'm broke.
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: