Re: Gradient syntax proposal

On Aug 16, 2009, at 2:53 PM, "David Perrell" <davidp@hpaa.com> wrote:

> Brad Kemper wrote:
> | ... You thinking you can just create a second
> | background thats as small as that box? I was think of that too, but
> | the gradation actually needs to keep going on all four sides of that
>
> I think I misinterpreted your comment (and you mine). I wanted  
> confirmation
> that, in an element with a background color but no border, it was  
> agreed
> that a gradient with these properties:
>
> background-size: calc(100%-200px) calc(100%-200px);
> background-position: 50% 50%;
> background-repeat: no-repeat;
>
> would be confined to its box and the background color (or an  
> underlying
> auto-sized gradient) would show as a 100px border.

Yes, I would say so.

> [...]
> Anyway, I'm all for simplicity, and it seems to me just this  
> suffices for
> <gradient-line>:
>
> [ <angle> | [ <bg-position> [ to <bg-position> ]? ] ]
>
> But this is just a valid subset of the current spec, right?

It is my point of view that  <bg-position> (and <bg-position> to <bg- 
position>) is unnecessary, and adds little more than a lot more  
verbosity, making it harder to read, and virtually assuring that  
simple gradients will be written in longer, more confusing ways than  
they actually need to be.

If you use an angle, then that tells you what side or corner to start  
from. This seems mostly uncontested, and no one has said it needs to  
be combned with <bg-position> (because the first and last color stops  
can have percentages or lengths). But the reverse is also true: if you  
use a single keyword to indicate what side or corner to start from,  
then it tells you the angle (towards the opposite side or corner).  It  
doesnt need to be combned with <bg-position> (because the first and  
last color stops can have percentages or lengths). Same same. Thus:

[<angle> | <starting-corner-or-side>]

So that all the distances or percentages are in the color stops, and  
are all distances from the same thing or percentages of the same whole.

> I think that it would avoid possible confusion if <color-stop> stood  
> for:
>
> [ <color> [ <percentage> | <length> ]? ]
>
> It just seems reasonable to have the required value come first.

I agree.

> <length> as an option is very important - how would I align a  
> particular
> band of gradient behind a headline without it?
>
> Might be good to require <color-stop>s to be in ascending order.  
> Less chance
> for misreading someone else's stylesheet.

If you allow lengths and percentages in the same list of color stops,  
then stops could trade places based on the size of the box they are in.

Received on Monday, 17 August 2009 03:41:20 UTC