Exploration

Archive: 30 May 2012

My detailed studies of CSS3 have, of late, taken me into the realm of repeating linear gradients. I’m not going to attempt a Lovecraft parody for this post, though I seriously considered it. Instead, I’m going to give you a summary of where we stand with repeating linear gradients, followed by some details.

The summary is as follows: NOT READY FOR PRIME TIME. In fact, not even ready for safe harbor in Europe. Whether they will become ready for use is up to the various browser makers.

I came to this conclusion after creating and evolving a test case for pattern regularity. The test compares a repeated PNG (red) with two theoretically equivalent repeating-linear-gradient images (blue and blue). The two repeating linear gradients are expressed differently, but should yield the same result. The visual result of the test should be a perfect interleaving where the blue and red patterns overlap.

To see what I mean, load up the test in Opera; or take a look at this screenshot of the first eight cases, taken in Opera. Either one will show you the reference rendering for this test case. Regular repetition and seamless interleaving, no matter what you do with the browser window’s size. That was and is the intended result.

If you want to go all the way to the other end of the spectrum, load up the same test in Chrome or Canary. It will be…different, at least in my testing on OS X and Windows. For extra fun, try dragging the browser window to resize. AHHHHGGGH.

In Firefox 12/Aurora 14 and Safari 5.1.7, all on OS X, I see something very close to Opera, except there are little one-pixel missteps here and there. Even better, the positions of these missteps will be different between the two gradient patterns; that is, for a given test the missteps on the top test will almost certainly be different than those on the bottom—assuming there are any at all. And all that was about as vague as can be because the missteps depend on the width of the element; again, try drag-resizing the browser window. Crawling artifacts!

I’m sorry, I promised no Lovecraft.

I’ve been told that Firefox 12 for Windows is rock-steady and Opera-regular, but I haven’t yet been able to verify that. I also haven’t tried out IE10 to see where, if anywhere, they stand with this. I imagine every build of every Linux browser ever has this nailed 100%, because that’s all Linux users say every time I launch one of these tests. Go you!

The point of all this being, as if I needed to restate it: don’t depend on repeating-linear-gradient for much of anything right now. There is pretty clearly a metric massload of work to be done before we can start calling these safe to use.