At 8:10 PM +0000 2/23/10, Philip TAYLOR wrote:

>I am confused.  If you take the example below, which may
>be seen online at
>
>       http://web-consultants.org.uk/sites/development/test-inheritance.html
>
>both the first outer div and the first inner (nested) div
>shew the same  background colour.
>[...] is it simply that the
>default background colour is "transparent", and therefore
>no inheritance is taking place but rather the colour is
>simply shewing through ?

    Yes, it's that.  The easiest test to see if a background is being 
inherited by a child element is something like this:

    div#outer {background: silver url(image.png) 0 0 no-repeat; padding: 1em;}
    div#inner {padding: 1em;}

If you see two instances of the background image, then the background 
is being inherited.  You won't, at least not in any browser I've seen 
in the past 15 years.  (Okay, there's one obscure case in IE/Win 
where you can cause the forced inheritance of backgrounds, but that 
was either a bug or a hack-- opinions vary.)
    You can simulate the effect of an inherited background like so, at 
least in recent browsers:

    div#outer {background: silver url(image.png) 0 0 no-repeat; padding: 1em;}
    div#inner {background: inherit; padding: 1em;}

That's why background properties aren't inherited, of course.

-- 
Eric A. Meyer (http://meyerweb.com/eric/), List Chaperone
"CSS is much too interesting and elegant to be not taken seriously."
   -- Martina Kosloff (http://mako4css.com/)
______________________________________________________________________
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