Correct CSS inheritance behavior for properties that aren't inherited?
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-05-24T22:12:42Z
Indexed on
2010/05/24
22:21 UTC
Read the original article
Hit count: 182
css
|inheritance
So say we you have a CSS property that is not inherited by default. We'll call it "foo" and its default value is "black". Then we make the following html.
<div id="div1" style="foo: red;">
<div id="div2">
<div id="div3" style="foo: inherit;">
</div>
</div>
</div>
Since this property does not inherit by default, you'd think that in div2, "foo" must be "black" - the default value because it does not inherit by default.
But ... in div3 should the value for "foo" inherit "black" from its parent that did not inherit foo, or should it inherit "red" from its grandparent because its parent did not specify foo?
I need to know because I'm trying to implement something exactly to the spec.
© Stack Overflow or respective owner