Saturday, June 12, 2010

Targeting colors in Firefox

Recent versions of Firefox come with automatic "colour correction" for images. This has caused me a number of issues, one in particular is what happens with a background gradient. Here is the break between the end of the gradient image and the background color in a recent site I worked on.

Comosite image assembled from 3 screenshots. From left to right: in Firefox there is a clear difference between the two parts of the image. In Chrome and Safari the image is a uniform color

The background color here is #2788de, or if you want to see a smooth background in Firefox, #4b7ed8.

[Aside - I use the Colorzilla add on to grab the correct color for Firefox from the page itself.]

The first time this happened I resorted to creating an excessively long background image, which is not a very elegant solution. Targeting Firefox just isn't generally as simple as targeting IE, but I have found a way to resolve this problem using the proprietary support for gradients: -moz-linear-gradient


background: #2788de; /* every other browser I've tested */
background: -moz-linear-gradient(top, #4b7ed8, #4b7ed8); /* Recent Firefox */


Hope this helps someone for now. What worries me is what happens to these sites when Firefox changes again (I try not to think about all the sites already out there).

0 comments: