alandor
02-14-2012, 11:13 AM
Hi,
I'm creating a page where I want a centered main container of 960px width with a 10px gradient border on each side. (Se example at http://www.hem.skyrev.se/).
At first I made a 980px wide 1px high image with repeat-y as background for the container. The problem was that I would sometimes get a 1px gap between the border and the content because the content centered slightly different than the image.
I don't want to use border-image because I don't think it works with IE. So I created one left-div and one right-div, which you can see at the linked page, with individual background images. Here's my dilemma now: I want the borders to fill the window size completely. So I set container height: 100%. It looks great when I load the page but if my window is small and I scroll down the border ends right there. I thought I'd solve this with background-attachement: fixed so that the borders would no scroll with content. But this doesn't work at all since the image is positioned relative to viewport rather than the div.
My current solution is to hardcode the height of the container to 1500px making sure it's never too small - but it's not a good solution.
How would I solve this? I want a background border on each side of the container, which centers uniformly and fills up the window height and continues to do so if I have to scroll down.
I'm creating a page where I want a centered main container of 960px width with a 10px gradient border on each side. (Se example at http://www.hem.skyrev.se/).
At first I made a 980px wide 1px high image with repeat-y as background for the container. The problem was that I would sometimes get a 1px gap between the border and the content because the content centered slightly different than the image.
I don't want to use border-image because I don't think it works with IE. So I created one left-div and one right-div, which you can see at the linked page, with individual background images. Here's my dilemma now: I want the borders to fill the window size completely. So I set container height: 100%. It looks great when I load the page but if my window is small and I scroll down the border ends right there. I thought I'd solve this with background-attachement: fixed so that the borders would no scroll with content. But this doesn't work at all since the image is positioned relative to viewport rather than the div.
My current solution is to hardcode the height of the container to 1500px making sure it's never too small - but it's not a good solution.
How would I solve this? I want a background border on each side of the container, which centers uniformly and fills up the window height and continues to do so if I have to scroll down.