tags:

views:

46

answers:

2

First of here is what I'm trying to achieve :

http://img801.imageshack.us/img801/1516/sitelayout.png

I just cant get the content div working as I would like it, when you get too the page the div should stretch too the bottom if there isn't enough content too fill it, if there is too much content it should push down the footer. Here's what I have so far:

HTML

<!DOCTYPE HTML>
<html>
<head>
 <title>site</title>
 <link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="container">
<div id="headerBG"></div>
<div id="header"></div>
<div id="content">
 <div id="contentTop"></div>
 <div id="contentCenter"></div>
</div>
<div id="footerBG"></div>
</div>
</body>
</html>

CSS

html,body{ height: 100%; margin: 0; padding: 0; }

body{
background-image:url('images/bg.png');
background-repeat:repeat;
}

#container{
position: absolute;
background-color: green;
height: 100%;
width: 100%;
}

#headerBG{
position: absolute;
background-image:url('images/header_bg.png');
background-repeat:repeat-x;
height: 297px;
width: 100%;
}

#header{
position: relative;
margin-left: auto;
margin-right: auto;
background-color: black;
width: 780px;
height: 200px;
}

#content{
position:relative;
margin-left: auto;
margin-right: auto;
width:780px;
height:70%;
}

#contentTop{
width:780px;
height:30px;
background-image:url('images/content_top.png');
background-repeat: no-repeat;
}

#contentCenter{
width:780px;
height:100%;
background-image:url('images/content_bg.png');
background-repeat: repeat-y;
}

#footerBG{
position: absolute;
bottom:0px;
background-image:url('images/footer_bg.png');
background-repeat:repeat-x;
width: 100%;
height: 144px;
}

Sorry if its a bit unclear, I've been tinkering with it a lot so this code might be a bit unorganize. I've been staring it to death and its starting to get blurry in my head >_< Anyway, I would really appriciate any insights you might have, thanks in advanced !

yay Coming back to html+css after a year or two yay

A: 

for ease i'd just look in to Faux Columns

set the #content to have a background image that resembles the effect you want.

you'll also probably want to look in to a sticky footer

Ross
I looked into bolth of them already, actually I implanted the sticky footer at one point but took it out again I guess I could put it back. The problem is the #content div though. I couldn't get the Faux columns to work because the div became too big. It didn't take the header size into account or something and gave the page a scrollbar without any content in the div.
xStoryTeller
A: 

See if this works for you: http://jsfiddle.net/brianflanagan/jhvBt/ IE mileage may vary (with the min-height property). If you absolutely need the footer positioned exactly at the bottom of the browser window and the content div stretched, I'd recommend using a JS solution to calculate assorted heights as needed.

Brian Flanagan
I really need the footer to stretch too the bottom, any link to a JS solution ? I didn't think it'd be this complicated =o
xStoryTeller
Sure. http://jsfiddle.net/brianflanagan/jhvBt/1/ I added lots of notes in the js to explain my thought process, but really, it's just a few lines of jQuery/JS
Brian Flanagan
Thanks ! That works wonders ! I was planning to use jQuery anyway so thats no problem, also I added a small animation ;) Thanks alot !
xStoryTeller