W3C home > Mailing lists > Public > www-style@w3.org > February 2004

Re: computed values, inheritance, and short hand

From: Tantek Çelik <tantek@cs.stanford.edu>
Date: Thu, 12 Feb 2004 12:15:29 -0800
To: fantasai <fantasai@escape.com>, <www-style@w3.org>
Message-ID: <BC511EBB.362AE%tantek@cs.stanford.edu>

On 2/12/04 9:52 AM, "fantasai" <fantasai@escape.com> wrote:

> 
> in Mozilla bug report 4510 Ian Hickson wrote:
>> 
>>> STYLE_NONE means there's no border; i.e. the border width must calculate to
>>> zero no matter what it's specified value.
>> 
>> It must _compute_ to zero, even, so this should happen during the cascade.
>> 
>> e.g.:
>> 
>>   div { border: none 2em red; }
>>   span { border: inherit; border-style: solid; }
>> 
>>   <div><span> test </span></div>
>> 
>> ...should not have any border. (We currently do this wrong. It works in
>> Opera.)
> 
> In
>  div {border-style: none;}
>  span { border-style: inherit; border-style: solid; }
> 
> Does the span have a border or not?

In your example it does, because it is equivalent to:

 div {border-style: none;}
 span { border-style: solid; }

but your example is not the same as Ian's.


Splitting up the shorthand in Ian's example derives to:

  div { border: none 2em red; }
  span { border-style:inherit; border-color:inherit; border-width:inherit;
border-style: solid; }

which simplifies to (since the latter declaration wins in a rule):

  div { border: none 2em red; }
  span { border-color:inherit; border-width:inherit; border-style: solid; }

Now, does the span have a border or not?

Specifically, does border-width:inherit inherit a zero width computed border
from the div, due to the div's computed border-style of none?

Tantek
Received on Thursday, 12 February 2004 15:16:03 GMT

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