Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Problem with CSS specificity


lucy24 - 9:34 pm on Oct 1, 2011 (gmt 0)


I've never understood this preference for id over class when the id isn't actually going to be used for something (like anchoring, or being called by a script). Isn't that that whole point of classes? Sure, it saves three bytes in the HTML, but let's not overdo it.

td {default behavior that you want your td to follow unless it gets instructions otherwise}
td.foo {instructions otherwise}
td.bar {other instructions still otherwise}
etc.

And, at that, you've only scratched the surface. If you have

table.foo td {stuff}
and
td.bar {other stuff, including some that's mutually exclusive with the previous stuff}

and your code has

<table class = "foo">
<tr>
<td class = "bar">

the td will generally follow the rules for "table.foo td" unless you explicitly say

table.foo td.bar {take that, cascading styles!}


Thread source:: http://www.webmasterworld.com/css/4369437.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com