
![]()
This is actually a simple concept. That few people understand.
You can only use linear gradients with this. (Radial or complex gradients would take up too much space.)
Latest revision:
2080814157
Previous revisions: 1080812806
You will need:
| Item | This tutorial uses |
| HTML/CSS editor | Dreamweaver CS3 |
| Image editor other than Paint |
Photoshop CS3 |
| Web browser(s) | Firefox, Internet Explorer, Flock, Safari, Opera, Amaya |
This is fairly simple, even if you don't have a gradient tool.
Personally, I hate Photoshop's gradient tool (when I'm trying to do this
)
Actually, you really can't use a gradient tool, as that makes a wide image.
So, here's an alternative.
Design a gradient using the 'Pixel' technique.
That's one pixel per color.
![]()
In Photoshop, use the 'Image Size' dialog (Under the Image menu, Ctrl-Alt-I)

Save your image in the same directory as your webpage.
I prefer to save it as a GIF with the 'Exact' palette and 'Force' to 'None'.
Make a blank webpage.
<head> section: <style type="text/css">
<!--
#apDiv1 {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 1;
}
#apDiv2 {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 2;
}
-->
</style><body> section: <div id="apDiv1"><img src="BACKGROUND.GIF" width="100%" height="100%"></div>
<div id="apDiv2">CONTENT</div>that the background will scroll with the page. This makes no effect if your gradient has a left color and a right color.
If your gradient has a top color and a bottom color, and you do not want this to happen, you can change this.
To do so, change position: fixed; to position: absolute; in the <head>, and add...
body,td,th {above
background-color: #RRGGBB;
}
#apDiv1 {.
RRGGBB should be the bottom color of your gradient.

This works well with Internet Explorer, Firefox, Flock, and Safari.
But not with Amaya or Opera.

I am working on a way to automate this process using PHP, ImageMagick, IMagick, JavaScript, CSS, HTML, scripts from Dynamic Drive, and GIFs. It shouldn't take long.