PictureSome Gradients!
Remember when we used to have to use 1 pixel ping image strips for gradients? Often they would be just black or white fading to transparent.

Code would look something like this:

background: url(../images/gradient.png) #EFEFEF bottom repeat-x;
Simple and worked everywhere, right? However, it was not fancy enough and you had to load that huge 2kb ping image.

Well, luckily it's gotten even easier. And here is a code sample:
background: rgb(125,126,125); /* Old browsers */
background: -moz-linear-gradient(top,  rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(125,126,125,1)), color-stop(100%,rgba(14,14,14,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); /* IE10+ */
background: linear-gradient(to bottom,  rgba(125,126,125,1) 0%,rgba(14,14,14,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7d7e7d', endColorstr='#0e0e0e',Gradient ); /* IE6-9 */
Ridiculous! 

This is the "new" way and probably, for reasons I don't know and don't care to look up, is the correct way to handle gradients these days. Luckily though, I found a website that helps with this: 

http://www.colorzilla.com/gradient-editor/

They have made a simple to use tool that really takes all the guess work out (hand coding). So if nothing else, this blog will serve as my bookmark back to colorzilla.com's gradient editor/creator. 



Leave a Reply.