Previous Message
Next Message

Re: [css-d] difference between class and id selectors

Sent by Lachlan Cannon on 31 January 2002 04:04

--- Jonathon Delacour [EMAIL-REMOVED]> wrote:
> I'm wondering if someone can succinctly explain (or point
> to an explanation 
> of) the fundamental difference(s) between CLASS and ID
> selectors. In all 
> the books and online resources I've looked at, the
> examples given seem to 
> me to be applicable to either selector. As in <p
> class="first-para"> or <p 
> id="first-para">.

It's more just a matter of choice. Some poeple use IDs for
programming, and classes for other style.s Personally I see
it as, you use classes for things you'll reuse more than
once per page, and IDs for things you'll only use once.
Therefore the elements I use in laying out a page will be
IDs and things which will be used in the page get a class
for example a menu div which is IDed, and a content div
which is IDed. Then in the page I might have a class for
images that get floated to one side of a paragraph -
because they'll possibly get reused.


Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
Previous Message
Next Message

Message thread: