W3C home > Mailing lists > Public > www-style@w3.org > March 2000

Re: background-color:transparent vs. background-color:inherit

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Tue, 28 Mar 2000 23:01:40 -0800
Message-Id: <200003290701.CAA09401@tux.w3.org>
To: pierre@netscape.com, "www-style@w3.org" <www-style@w3.org>
From: pierre@netscape.com (Pierre Saslawsky)
Date: Tue, Mar 28, 2000, 10:34 PM
> Visually speaking, what is the difference between
> 'background-color:transparent' and 'background-color:inherit'?

Pretty big visual difference.

background-color:transparent will allow anything underneath to show through -
that means any content, background images, borders etc. of elements that this
element happens to be drawn over.

background-color:inherit will take the background color of its parent, and
draw over anything that is overlapped, including the background-image (if any)
of its parent.

> Note: the
> latter was not legal in CSS1, it came with CSS2.

Yes, a correct CSS1 browser should ignore background-color:inherit.

This page actually demonstrates this in the CSS1 test suite:


Check out the paragraph (P.two - which is actually the third test paragraph)
which says:

"This paragraph should have a solid gray background (or a white grid), because
in CSS1, inherit is an invalid keyword, and in CSS2, it will cause the gray
background (not the white grid) to be inherited. "

Try this in IE5/Mac (which supports "inherit" for all CSS properties per
CSS2), and it shows a gray background for that paragraph.   "transparent"
would have allowed the white grid to show through.

Received on Wednesday, 29 March 2000 02:02:00 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:53 UTC