Re: computed values, inheritance, and short hand

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 UTC