Re: [css3-color] Fractional values for HSL

On Tue, Jan 4, 2011 at 16:16, Rob Crowther <robertc@boogdesign.com> wrote:
>
> The spec doesn't seem to mention: are fractional values allowed in HSL notation?  For example if I have a color hsl(210,50%,40%) and want one at one third of the level can I use hsl(210,50%,13.3%)?  Is it actually going to be any different to hsl(210,50%,13%)?
>
> Firefox and Opera seem to handle it fine, but I'm not sure if they're just rounding things internally or something.
>
> Rob
>

The Color module mentions that the first value for hsl() is a number,
and the two following values are percentages. According to the Syntax
module[1], percentages get parsed as:

[0-9]+|[0-9]*"."[0-9]+ %

So syntactical speaking: yes, they are allowed. I wouldn't know
whether the displayed color differs based on the fraction for any
browser. Can't you compare the displayed colors of
"hsl(210,50%,40.999%)" with "hsl(210,50%,40.001%)"?

Kind regards,
Peter Beverloo

[1] http://www.w3.org/TR/css3-syntax/#lexical

Received on Tuesday, 4 January 2011 16:02:03 UTC