W3C home > Mailing lists > Public > www-style@w3.org > August 2009

Re: Gradient syntax proposal

From: James Elmore <James.Elmore@cox.net>
Date: Wed, 19 Aug 2009 07:19:38 -0700
Message-Id: <DD844E20-5BE3-48D1-86DF-23CC421C4812@cox.net>
Cc: CSS <www-style@w3.org>
To: Brad Kemper <brad.kemper@gmail.com>

On Aug 18, 2009, at 10:27 PM, Brad Kemper wrote:

> On Aug 18, 2009, at 9:40 PM, David Perrell wrote:
>> background: linear-gradient(-70deg / yellow 52px / blue 52px);
>> .
>> .
>> background: linear-gradient(20px 30px to right 20px bottom 30px /  
>> yellow,
>> blue);
>> ---
>> Neither example is an easy read - the first could get very  
>> difficult with
>> many color stops.
> So could the second. Oh wait, it already is.
> I'm just thinking there would be times when you wanted a gradient a  
> fixed distance from the end, not just the beginning, not  
> necessarily a mirror of the beginning measurement, so it would be  
> nice to have a way to specify that without a lot of calc(), which  
> is even harder to read. A second slash version doesn't seem so bad  
> for that. Basically just a slash instead of a comma there.

I was thinking last night (away from my beloved computer so I could  
not send immediately ;) and thought about the possibility of using  
negative numbers for both percentages and lengths. Positive values  
are distances / percentages of the length FROM THE START of the  
gradient line; negatives are FROM THE END of the line. This makes the  
gradient syntax simpler -- no extra slash. The developers will need  
to handle more 'overlap' possible problems -- especially with mixing  
lengths and percentages from both start and end, this could be  
harder. What do the rest of you think of this?

It might be worthwhile to limit the negatives to the end of the list  
of color stops. E.g., after the first negative, all the rest MUST BE  
negatives or it is an error. This limits mixing negatives and  
positives and simplifies, somewhat, the problems.

Personally, I prefer to allow any value, anywhere in the list of  
color stops, but could live with the above limitation. A scenario  
where developer(s) wanted to intermix positives and negatives would  
not be too hard to create, but at least allowing negatives (distances  
from the end of the gradient line) would reduce much of the need for  

Received on Wednesday, 19 August 2009 14:20:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:38 UTC