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

Re: [css3-images] Resolving on gradient issues

From: Brad Kemper <brad.kemper@gmail.com>
Date: Thu, 4 Aug 2011 09:57:09 -0700
Cc: www-style list <www-style@w3.org>
Message-Id: <1CDF05AA-1A4B-4DBE-985D-A25362FE9156@gmail.com>
To: Tab Atkins Jr. <jackalmage@gmail.com>

On Aug 2, 2011, at 7:00 PM, Tab Atkins Jr. wrote:

> My preferred outcome for the linear-gradient keywords is to have them
> remain as they are.  There is more possibility-space to explore here
> in the realm of linear gradients, as recently pointed out by Behnam
> Esfahbod in the "Gradient Magic" thread, and I would like to address
> that in Image Values 4 with more time to put proper thought into the
> matter.  

I don't think you should punt on that idea. There is no good reason to leave it out of css3-images. It is simple to spec, always produces better looking results, and so far has been non-controversial.

I think Brian Manthos has it right in how he describes it. You basically just have to find the angle that joins the two corners as if the box had been turned 90deg first, and then use that on the unturned box as if the gradient line angle had been specified in that many 'deg'. The result is a gradient that acts more like a 'cover' than like a 'contain', just as Ndeg linear gradients do. I wouldn't expect authors to care about what math you used to get there, as long as the gradient connecting the corners looks reasonable. And I think this change makes it look much more reasonable, and I suspect most authors would agree when comparing rendered results.

I believe Brian said that IE10 would do this (has done this?) for their prefixed version, so it appears to be a fairly easy implementation change, and you will be able to compare their results with other implementation.

The other downside of punting on diagonals is that is makes 'downward', 'upward', etc. seem much more reasonable than they really are, because nobody then sees the awkward combinations for corners ('downward rightward', gaaaah!). 

Person 1: "How do I get to Miami from Seattle?"
Person 2 (waves hand indistinctly at a map of the US): "downward... rightward... you know, over that way."
Person 1 (looking at person 2 like he is an idiot): "Never mind."

I know I said I'd go by what you chose, in order to avoid further argument, so I'm just saying. I expected a better considered choice from you. 95deg could be described as 'downward rightward', without coming close to describing an optimal path to connect corners, except in a tiny minority of cases.

P.S. "down" and "up" are already directions that are not confused with positions, and don't need 'wards' added to them.
Received on Thursday, 4 August 2011 16:57:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:03 UTC