W3C home > Mailing lists > Public > www-style@w3.org > January 2003

Re: Inheritance for border-color - All browsers wrong except Opera 7?

From: John Lewis <lewi0371@mrs.umn.edu>
Date: Thu, 16 Jan 2003 21:10:51 -0600
Message-ID: <107470583469.20030116211051@cda.mrs.umn.edu>
To: www-style@w3.org

Rijk wrote on Thursday, January 16, 2003 at 7:25:00 PM:

>> Kevin W wrote:
>>
>>> http://www.hixie.ch/tests/adhoc/css/inheritance/border-color/001.xml
>>>
>>> Should the border of <inner> be green or red? Here is the CSS:
>>> test { display: block; color: red; border: none; }
>>> test > inner { border-color: inherit; border-style: solid; color:
>>> green; }

It should be red. It would be green with this (slightly different)
CSS:

  test { display: block; color: red; border: none; }
  test > inner { border-color: inherit; border: solid; color: green; }

Or this (CSS3):

  test { display: block; color: red; border: none; }
  test > inner { border-color: initial; border-style: solid; color:
  green; }

In the first example, the border property sets the value of
border-color back to the initial value. In the second example, the
border-color property is explicitly set to the initial value. In both
cases, the common difference is that the border-color property isn't
using a value of inherit. In the first case, it's overridden, and in
the second case, it's never used at all.

So I think the page is wrong, and the initial value shouldn't be used
(for the inner element), unless I'm missing something. And I
definitely could be. :)

                              *  *  *

Why red? The inherited value of the border-color property on the inner
element is the *computed* value of the border-color property on the
test element. The initial value of the border-color property is the
value of the color property (see CSS2 section 8.5.2). The value of the
test element's color property is red, which means the value of the
test element's border-color property is also red, which means the
value of the inner element's inherited border-color property is also
red. The inner element never touches the initial value of the
border-color property, which means it shouldn't be green.

-- 
John
Received on Thursday, 16 January 2003 22:10:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:19 GMT