Is there an easy way to make a gardient background

TheNewbie

Senior member
Jul 17, 2007
740
0
0
I know its possible to make a gradient picture using photoshop and then use it as background, but I was wondering if there's an easier way through pure HTML or perhaps something with CSS?
 

ahurtt

Diamond Member
Feb 1, 2001
4,283
0
0
You can use the old image size tag hack I suppose. If you want a vertical gradient that spans say 600 pixesl, create a single pixel wide by 600 pixel tall image that has the gradient and then use the width attribute of the IMG tag to stretch it across the page. If you want a horizontal gradient, make a horizontal single pixel tall image and stretch it down the page vertically using the IMG tag's height attribute. This way you have a very small file sized image to download but the browser does the work of stretching it out to look like a gradient that covers the whole page. Alternatively, you just put it as the background attribute of the body tag and the browser will tile it for you giving you the same effect.