tags:

views:

31

answers:

1

thanks for help, ended up with this

html{ position:relative; min-width:950px; height:100%; background:black url(images/GrassBG.png) repeat-y top center;

font:13px "Lucida Grande",Helvetica,Arial,sans-serif;
}

body.main{ width:950px; margin:0 auto; position:relative; }


is there any way when using a div for a background image- to limit the height to only the content displayed?

im putting the background image in a div because i want it centered via position:relative but the image doesnt show up unless i put a height on the div, and thats not what i want because i dont want to be able to just scroll down to the bottom of the image where theres no content

ive tried putting the background image on the body css but if the browser is less than the width of the image, it just throws it over to the left and you can only see half of it- is there no way to make the background position:relative on the body?

sorry if that doesnt make sense ><

thanks

why can you not use Position:relative; on the body?

A: 

You can set your div's height to 100% and set it with no-repeat to keep it from propogating throughout the div. Make sure all of its parent elements contain a 100% height though (all the way up to body). It won't force itself, then, to be a certain height. It will just fill the page.

This is all assuming, of course, that you don't care to interact with what's underneath the div in question.

<style>
body,
#parent {
    height: 100%;
}

#the_one_with_the_background {
    background: url('background.png') no-repeat top center;
    height: 100%;
    width: blahpx /* You're still going to have to define a width of some sort */
}
</style>

<body>
    <div id="parent">
        <div id="the_one_with_the_background">
        </div>
    </div>
</body>
dclowd9901
it doesnt seem to be showing any of the image with just using the 100%
Gazow