I am trying to make a page with a background that scales to the browser width, regardless if the page is greater in height then the browser width, and then place content below the background.
I have achieved this with the background, but I had to use absolute positioning for it to work, so I am having a hard time figuring out how to push down the main container. So either a way to do that, or make the background follow the browser width without the use for absolute positioning.
Any ideas would be appreciated!
The css of the background div and the main container to be pushed down:
#supersized {
display: block;
position: absolute;
left: 0;
top: 0;
overflow: hidden;
z-index: -999;
height: 100%;
width: 100%;
}
#main-container {
height: 100%;
display: block;
overflow: hidden;
}
Place your
main-container
div just outside yourcontainer
div. If you would like to then reduce the space between the content and the background, then you can replace yourmain-container
css with something like this: