At 12:17 PM +0900 6/1/05, Philippe Wittenbergh wrote:
On 1 Jun 2005, at 2:27 am, Adam Kuehn wrote:
div#stylea{ font-weight: bold; color: blue; }
p.styleb{ color: red; background: yellow; }
The word "bar" will be bold, blue, and have a yellow background.
div#stylea is more specific than p.styleb. Accordingly, anywhere
the two conflict, #stylea will apply and override .styleb. Hence
the text is blue, not red. However, both selectors still apply to
the element, so where the rules do not conflict, each will be
applied. Hence the text is both bold, and has a yellow background.
Ahem Adam.
The text in the paragraph will be ***red***, bold, with a yellow background.
Consarn it, you're right. The default value of "color" is "inherit",
but any inherited value is reset by any explicit declaration. For
this example to work correctly, the selectors must choose the same
element, which clearly in this case they do not. The example works
if the two selectors are p.styleb and #stylea p (thus both selecting
the paragraph, but with different specificity), but not here where
one selector is picking out an entirely different element.
I should really test stuff like this before sending it out. It is
easy to confuse principles. Good catch, Philippe, and sorry to all
for the bit of misinformation.
--
-Adam Kuehn
______________________________________________________________________
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/