W3C home > Mailing lists > Public > www-style@w3.org > December 2010

[css3-values] unitless zero lengths inside 'calc()'

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 29 Dec 2010 12:41:59 -0500
To: www-style@w3.org
Message-ID: <20101229174159.GA11580@pickering.dbaron.org>
calc() expressions, defined in
http://dev.w3.org/csswg/css3-values/#the-calc-min-and-max-functions , 
do not allow unitless zero to be treated as a length, since the spec
  # The context of the expression imposes a target type, which is
  # one of length, frequency, angle, time, or number. NUMBER tokens
  # are of type number. DIMENSION tokens have types of their units
  # (‘cm’ is length, ‘deg’ is angle etc.); any DIMENSION whose type
  # does not match the target type is not allowed and must be a
  # parse error.

I think this is a good thing; the only use cases for zero lengths
that I can think of are for the output of tools that might be
generating nonzero lengths, and in such cases the tool would
presumably be generating the unit anyway.

However, since this isn't explicitly stated, and it might trip up
authors or implementors, I think it would be good to add a note
(near the text above) that this means that '0' is never a dimension
inside calc(), even though it is allowed to be a length outside of a
calc() expression.


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Wednesday, 29 December 2010 17:42:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:41 UTC