Log in

View Full Version : Using CSS Gradients for Dynamic Pages



dmbware
09-19-2008, 03:57 PM
I have many areas in my site that I want to apply gradients with css and images however the areas are dynamic. Is there a way to address this issue and make the gradients change with Height?

MrLeN
09-21-2008, 12:59 PM
If you want to make a gradient background image expand to suit the height of a particular container, I don't think this is possible.

But in such instances, what I do is set the gradient so that it suits the most common height, and then taper that gradient off to a single color so that if the height expands, it wont look too bad.

If you have a gradient tat starts with light blue, and ends with dark blue (say) 100 pixels, then make an image 500 pixels high and 1 pixel wide -- where the bottom 400 pixels is all dark blue.