Re: [css3-*] Review of functional syntax in CSS

2012/1/21 Christoph Päper <christoph.paeper@crissov.de>:
> Tab Atkins Jr. (2012-01-20 03:01):
>> Rounding Functions
>> ==================
>>
>>    ''roundup(<css-value>, <modulus>)''
>>  Rationale
>>    Generalizing the round functions seems useful for calc() and other
>>    places.  The order "value then modulus" matches basically every
>>    programming language.  However, you need 1-token lookahead if you
>>    omit the comma, because the <css-value> could be any number of
>>    arbitrary tokens.  Also, the common representation of this in math
>>    uses commas.
>
> What about
>
>  <rounding> := [‘up’ | ‘down’ | ‘even’ | ‘odd’]
>
>  ‘round(’ <css-value> <rounding>? <modulus>? ‘)’
> or
>  ‘round(’ <css-value> <rounding>? [, <modulus>]? ‘)’
>
> with <modulus> defaulting to 1 of the unit specified for <css-value>?

Simon got it - you can't default the modulus unless you say something
like "if it's a length, the default modulus is 1px".  Using a keyword
or a calc() expressions or possibly other types of things can give you
a value without a definite unit.

~TJ

Received on Saturday, 21 January 2012 16:42:59 UTC