I have a site where all the pages are unfortunately different lengths. My background image is a gradient, and I originally just used a long version of the image to cover all eventualities. It's now been pointed out, however, that this producers a scroll bar on the shorter pages, which makes viewers expect to find something at the bottom of the page. I therefore want to set the height of each page's background image individually.

I know I can do this by creating a different Photoshop image for each page, but this seems hugely time-consuming. I was hoping there would be some code by which I can dictate a cut-off point for the background image, but haven't found one. I obviously don't want to just shrink the image, as this wouldn't work in the transition between pages.

Any advice would be appreciated please!