W3C home > Mailing lists > Public > www-style@w3.org > June 1999

Re: syntax of rect()

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Thu, 24 Jun 1999 22:54:48 +0200 (MET DST)
To: www-style@w3.org
Message-ID: <14194.37628.956983.266095@www43.inria.fr>
L. David Baron writes:
 > This problem came out of a discussion on netscape.public.mozilla.layout.
 > 
 > The CSS2 spec defines the syntax of the rect() [1] function (for the
 > clip property) as without commas:
 > 
 > rect (<top> <right> <bottom> <left>)
 > 
 > but then gives examples with commas:
 > 
 > P { clip: rect(5px, 10px, 10px, 5px); }
 > 
 > The W3C CSS2 validator [2] requires the commas, and Microsoft
 > documentation [3] on the matter gives the rect() function without
 > commas, as does Liam Quinn's CSSCheck[4].  I tend to think the CSS2
 > examples and the CSS2 validator are wrong, and both should be
 > corrected.  Is this the correct interpretation?

No, I think the example is right and the definition is wrong. All
other functional notations in CSS have commas (rgb(), format(),
counter(),...).

It is better for extensibility to require a comma. It allows that the
simple values one day be replaced by expressions:

    rect(5px+10%, 10px, width/2, 5px)

without requiring extra parentheses.

It is also more in keeping with what people are used to in other
languages.


Both Netscape and MSIE currently accept with and without commas. Such
error recovery is counter to the spec and not a good idea in general,
but in this case it is probably not very dangerous.

However, the 'clip' property is at the moment almost unusable for
another reason, and that is that both MSIE and NS interpret right and
bottom in the opposite way from the spec: for them rect(0,0,0,0) means
completely invisible, while rect(0,100%,100%,0) is completely visible.
The spec has exactly the opposite. Some people claim that it is easier
to write scripts this way. It might become an erratum.

 > 
 > David
 > 
 > [1] http://www.w3.org/TR/REC-CSS2/visufx.html#clipping
 > [2] http://jigsaw.w3.org/css-validator/
 > [3]
 > http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/clip.asp
 > [4] http://www.htmlhelp.com/tools/csscheck/



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 Thursday, 24 June 1999 16:54:51 GMT

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