Forum Moderators: not2easy
A class is something that can appear multiple times within one document.
In other words, an id is a distinct thing, but a class is a type of thing: so your site menu or your top banner might have an id, but your news articles would have classes.
Basically, they both do the same thing WRT css, however an ID should only be used once in a document, whereas a class can be used over and over.
For example, you only have one <div id="header">, but may have many <p class="rightalign">.
There are some underlying XML reasons, I believe, however sematically speaking an ID is just that, an ID, and is unique, whereas a class can be applied to a group of things.
Whew, clear as mud, eh?
The reason is, If I define a div(say <div id="eventdetails">), then I can use my stylesheet to define the behaviour of the elements within that div without using classes. This saves a bit of HTML coding since I don't have to use a bunch of classes on the elements inside the div.
You don't even have to define any rules for the actual id.
#eventdetails p{margin: 5px auto}
#eventdetails span{font: bold}
etc..
This avoids something like:
<p class="someclass">
<span class="bold">Blah</span>
</p>
Well, I hope that make sense ;)
Birdman
Jennifer<--I hope that made sense....