On 11/29/05, Mark Fredrickson <[EMAIL PROTECTED]> wrote: > Here's a general question about CSS that I've been able to quite figure out. > If one has a DIV that will only appear once per page, which should one use: > a class or an id?
Well lMO, an id should be used for a specific item that won't appear in any other page. > > Classes are obviously useful at applying to multiple elements, or applying > multiple classes to one element. What advantages have that classes do not? > Specificity comes to mind, but the CSS rules regarding this are hazy in my > mind and I do not know if ids provide more specificity than classes. Technically it's the hmtl parsers of the browsers that makes this hazy iirc. There should only be one id/element type on a particulare page, but the browsers are very forgiving. Maybe xhtml is more strict(stricter?). A class should be used a more general case - for instance if you have some sort of 'error' messages in your pages a .error class is appropriate, that way you can have a defined look for all error message throughout the app. hth, -- Keith Sader [EMAIL PROTECTED] http://www.saderfamily.org/roller/page/ksader http://www.jroller.com/page/certifieddanger ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
