Re: Comment on Shorthand Precedence

On Sun, 31 Jan 1999, Albert Lui wrote:

> I was just fooling around with some of Internet Explorer's CSS
> properties and by mistake I saved on the files with the following
> rule:
>
> P { cursor: crosshair; border: thick; border-color: red }
> 
> I know the above declaration is invalid since I've specified the
> width of the border in shorthand but I also specified border-color
> explicitly.

It isn't invalid.

It should result in the following rules:

 P { cursor: crosshair; }
 P { border: thick none <value of 'color' property>; }
 P { border-color: red; }

which is equivalent to:

 P { cursor: crosshair; }
 P { border-top-width: thick; }
 P { border-right-width: thick; }
 P { border-bottom-width: thick; }
 P { border-left-width: thick; }
 P { border-top-style: none; }
 P { border-right-style: none; }
 P { border-bottom-style: none; }
 P { border-left-style: none; }
 P { border-top-color: <value of 'color' property>; }
 P { border-right-color: <value of 'color' property>; }
 P { border-bottom-color: <value of 'color' property>; }
 P { border-left-color: <value of 'color' property>; }
 P { border-top-color: red; }
 P { border-right-color: red; }
 P { border-bottom-color: red; }
 P { border-left-color: red; }
 
> The user agent ignored it and simply displayed what was contained
> within <P> without style.
It should have drawn it with no visible border, but the cursor should
have been a crosshair.

> I've no doubt that it is correct in assuming such rendering, so just
> out of curiousity I searched the CSS 2 specification on information
> relating to shorthand precedence. There was none.
That is because there is nothing special about shorthand precedence.

Just expand it as above, and it is clear.

-- 
Ian Hickson

Received on Sunday, 31 January 1999 19:30:00 UTC