Barbara de Zoete
I'm not sure what you mean here (still learning like every other day or
so, see

). I use [id]'s on <div>'s for layout mainly because an [id]
has more weight in the cascade than a [class] has,
Where does it say that? It does not.
Hang on. They do. If I set an [id] and a [class] on the same element, the
styles in the definition for the [id] get preferred over those in the
[class] regardless of their occurance in the stylesheet (what ever comes
first or last).
See <
http://www.w3.org/TR/CSS21/cascade.html#cascading-order>. My
interpretation of that text is that (a) inline styles have more weight
than (b) id's, which have more weight than (c) classes, which have more
weight than (d) any preset or inherited element or attribute style. How am
I wrong in interpreting that bit of text?
so styles I define for
a div with some [id] are preferred automatically over some of the
overall
styles, when rendered by a graphical browser. With a [class] I find that
is not always the case.
Nope. Style rules select elements. Selecting by ID or class is
irrelevant.
What *is* relevant is the the specificality of the selection and, failing
that, the order of the style rules. All of this is explained in the
specification in the "selectors" chapter.
The problem with ID is that (to validate) only one element may have that
ID.
That's not a problem. That's a virtue
<snip classes versus id's used to style a bunch of paragraphs>
This is not what I mean or was talking about. I guess I've not been clear
enough than.
I agree that on an element level one should use, preferrably, classes or
perhaps stick to styling the element itself if possible. That is KISS.
I was referring to (or tried to refer to

) the situation where you
create containing <div>'s to layout a page. For those containing <div>'s I
use [id]'s as there is no second [id="content"] or [id="menu"] on one
page. Or there should not be anyway.
I prefer to use [id]'s for those containing <div>'s, because then they are
truely unique. It give me the opportunity to create fragment links
(whatchamacallit in English?) to specific parts of my page where they are
useful _and_ to style the contents of each containing <div> differently.
Really entirely differently. If I want to, that is.
<style id="example" class="don't bash me for my use of not safe colours">
body { color:green; }
strong { color:navy; }
strong.extra_important { color:red; }
strong.extra_extra_important { color:red!important; }
#top { color

urple; }
#menu { color:maroon; }
#something_else { color

range; }
</style>
<body>
<p>Just some text that is green and <strong>some
navy too</strong>.</p>
<p>Some more green text, <strong
class="extra_important">now some red</strong>.</p>
<div id="top">
<p>And this should turn up purple. Nice

</p>
<p><strong>With this still being purple</strong></p>
</div>
<div id="menu">
<p>And here some maroon, <strong
class="extra_important">staying maroon</strong></p>
</div>
<div id="something_else">
<p>And now orange

(hate me yet?) with, finally,
<strong class="extra_extra_important">some red
text</strong>.</p>
<p>As this <strong style="color:red;">will be red
too</strong></p>
</div>
</body>
If with an element in the markup no color is specified with inline style,
the color expressed in either <body> or one of the [id]'s of the
containing <div> will be rendered.
With an element <strong> used in the body it will be rendered with
color:navy. In one of the containing <div>'s it will inherit the color of
that containing <div>.
If the class .extra_important is added to the element <strong>, red will
be it's color, but still only in the body.
If strong.extra_extra_important is used in one of the containing <div>'s,
than the color will be red there also, due to the !important rule.
Therefore the use of an [id] for a containing <div> gives a firm control
over the design of your page (where that is applicable; always keeping in
mind that it is impossible to design pixel perfect for all those different
graphical browsers out there, let alone the not graphical ones).
At least this is how I understand the cascade works and it is what I think
I see happening. But if I'm wrong, I'm sure someone will point that out to
me
