I feel rather silly asking this question. But. Could someone please explain the difference between using an 'ID' and 'Class' in the DIV tag.
I've been trying to figure it out for a few months, and I know that it's simple, and I know that one allows the classification of multiples, whilst the other classifies a block, but I just can't grasp or visualize the difference.
Help.
I'm stumped.
Posted by: Da Goddess on Octubre 31, 2004 02:54 AMme too ;oD
Posted by: munin on Octubre 31, 2004 09:04 AMMy "cheat sheet" reference is this site. I have gone back to on several times, even to refresh my memory. Just my two cents.
Posted by: shelli on Noviembre 5, 2004 10:33 AMID is a unique identifier for a single block. With XML syntax, an 'ID' element cannot have a repeated value. Mostly, you won't want to use this in CSS.
Class is an identifier you can use for similar blocks -- like multiple sidebar boxes that should have the same CSS rules. Generally, attach your CSS rules to a class that can be used for multiple DIVs.
This really becomes important when you're using XHTML, as a repeated ID attribute (on any element, not just elements of the same type) will mean you no longer have a well-formed XML document, much less a valid one by the XHTML DTD.
And to think that I got here by accident searching on google...
Posted by: Josh on Noviembre 8, 2004 11:03 AMthanks bunches Josh.
that helps a lot!
fortuitous accident. :o)
Posted by: munin on Noviembre 10, 2004 08:03 AM