-----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.

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.

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.)

Beth


______________________________________________________________________
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/

Reply via email to