views:

61

answers:

2

Hi!

I have a div that is the body of my site, inside that div I put a div on the left side (to have a vertical menu)

http://www.freeimagehosting.net/uploads/117f79fa0e.png http://www.freeimagehosting.net/uploads/4569a5f550.jpg

My question is, how can I make the menu div follow up to the bottom of the body div so that it doesn't look like it was cut, because of the color the menu div has...I've played around with properties like position, margins, float, yet I can't seem to get it to work... I've included two pics so that you can see the divs!

Sorry pics don't appear because i'm a new user!! i've included links though...

The first picture is the inital page, and the second is after content was added and the body div expanded to make that content fit!

Any help appreciated!

+1  A: 

This technique has always worked for me. See http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/

The background is actually on the wrapper of the two columns though.

Keyo
Yes, I actually thought of doing that background thing but thought it might be to primitive. I decided to do it like this, simple.
ber.query
+1  A: 

This is really something best approached with CSS.

Say this is your structure:

<body>
 <div id="main">
  <div id="leftSide"></div>
 </div>

I think what you'd want to do is give the left side a height of 100% in your CSS:

#main {
  height:500px; /*this can be whatever height you want for your main div*/
  width:700px;  /*same with this, for its width*/
  background-color:#F00; /*just to show you the effect*/
}

#leftSide {
  float:left;  /*THIS is where the magic happens, to "pull" it to the left*/
  height:100%; /*This makes sure it reaches all the way to the bottom*/
  background-color:#00F;  /*or any color you'd like (which is a great song btw)*/
  width:200px;  /*or whatever height you'd like*/
}

This all assumes of course that you don't have extra margins and padding on your divs or other elements. You also might want to consider a "CSS Reset" like this one

Trafalmadorian