On 20/07/2010, at 11:06 AM, Beth Lee wrote: > -----Original Message----- > From: css-d-boun...@lists.css-discuss.org > [mailto:css-d-boun...@lists.css-discuss.org] On Behalf Of Chris Blake > Sent: Monday, July 19, 2010 8:50 PM > To: css discuss discuss > Subject: [css-d] ID vs. Class > >>> I understand the difference between class and ID to a basic >>> level. ... >>> - what's the real difference other than using it once or multiple >>> times? > > > 1. If you use an ID multiple times, your HTML won't validate. Maybe > you > don't care about that.
I do care. > > 2. There is a difference between ID and class in the "cascade" in > css. If a > div has both a class and an ID, the ID rule trumps the class rule, > since an > ID has more specificity than a class, You can use the cascade to > streamline > your stylesheet. Aha I learnt that. Forgot to say. > > 3. If you use Javascript, your getElementById functions could go > blooey if > there are multiple divs with the same ID. (If there's a more > technical terms > for it, I don't know it.) But it's OK if they classes? > > Beth > Really for this because it is only appearing once for now I should use ID - but there's a good chance I may use it again later on this page - so class for now is OK? Cool and thank you. ______________________________________________________________________ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/