Re: CSS2 Section 8.5.4 Example

L. David Baron writes:
 > The last example in CSS2 section 8.5.4 is somewhat misleading, I think,
 > because no border-style is set.  This contributes to the view of the
 > people who are making Netscape's test suite that border-style does not
 > need to be set to produce a border.  (Fortunately NGLayout does not
 > exhibit this behavior, but it does have the empty padding bug and the
 > default border-width is wrong.)
 > 
 > The relevant link is:
 > http://www.w3.org/TR/REC-CSS2/box.html#border-shorthand-properties

This merits a bit of history. The current interpretation is indeed as
David says: if 'border-style' isn't set, it will be 'none' and thus no
border will be displayed. However, there was a time when the
interpretation was different.

At first, there were only 5 properties: 'border-top', 'border-right',
'border-bottom', 'border-left' and 'border' and they accepted values
like 'none' (the initial value), 'solid blue', 'medium', etc. If you
set them to anything other than 'none', you would get a border, by
default solid, medium, and in the text color. (We're talking early
1996 now.)

The idea was that a border style has various aspects, depending on the
kind of border (color, background, pattern, line style, sizes of
patterns and the gaps between them, joinings at the edges, shadows,
etc.) but that it was really a single style that you therefore set
with a single property. Initially, only a particular kind of border
(straight lines) and three three of these aspects (color, line style,
overall thickness) were exposed, the rest might come later.

However, script languages on the Web had trouble with property values
that are not primitive types, and therefore the properties
'border-*-width' were added, sometime during 1996 (and in CSS2 also
'border-*-style' and 'border-*-color'). The existing 'border-*'
properties suddenly became shorthand properties. The effect was that
the interpretation of 'border: medium red' changed from producing a
solid red border to producing no border at all. Not very intuitive
maybe, but consistent with its new role as a shorthand property.

The addition of the individual -width, -style, and -color properties
also pushed ideas about corner pieces, patterned borders, and more
interesting shapes (flower patterns, varying thickness, drop shadows,
gradient & fuzzy borders,...) to the background. The split into
color/width/style made it more difficult to introduce other aspects.


But back to the example. The final example in 8.5.4, although formally
correct, may indeed be confusing: three of the four sides of the
border are red, but their style is 'none', so you can't see it...
(assuming no other rules in the style sheet).

The point of the example, of course, is not that three of the sides
are red, but that the left side is *not* red. And that side you *can*
see.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Wednesday, 7 October 1998 11:13:46 UTC