tags:

views:

820

answers:

1

Hi guys.

Im trying to get a div to auto adjust to the height of the div to its right.

You can see an example here www.littledesignplanet.co.uk/lloyd The white space div on the left i set the height manually.

Is there a way to get this to automatically stick to the same size as the main content div? As each page is going to be a different height.

Thanks, Sav

A: 

Hmm... Why don't you just set the margin-left of #content to 400px? This would yield the same result but in a much simpler way.

Cheers :)

Update: if you want to make both columns equal height, there is several of techniques for this. My favourite is this one:

<div class="container">
    <div id="whitespace">Lorem ipsum</div>
    <div id="content">Foo<br />bar</div>
</div>
<style type="text/css">
.container {overflow: hidden;}
#whitespace, #content {padding-bottom: 32767px;margin-bottom: -32767px;}
</style>
moff
That is a cleaver way of looking at it, but in the other pages there is going to be a bit of content on that white space. Also im looking at this for anther site too :D - Also the user who wants the site, will be changing images all the time, so some will be heigher than others.
what exactly is the rationale behind padding-bottom: 32767px;margin-bottom: -32767px ?
Peter Perháč
-32767 is the minimal possible margin (at least in Safari). Thus, we set a padding-bottom of 32767px, and then remove it by setting the negative margin. This results in a lot of empty whitespace under the columns, so we add a wrapper with overflow: hidden; Boom.
moff
Thanks Moff..Will give that a shot later.
Err dont know what i did wrong.I put the container around my code.Then added in .container {overflow: hidden;}#whitespace, #content {padding-bottom: 32767px;margin-bottom: -32767px;}But it just makes the page blank with the background from the body show the whole way down lol.
ok so i had a , in the wrong place so now it seems to work, except if i take out the height: 1501px; from the white space it just collapses, and is grey
I think you have to add some content to #whitespace – try adding a " " or something.
moff
nada, i will upload it quick so you can see
Its uploaded... www.littledesignplanet.co.uk/lloyd
I'd suggest you to take a look here: http://www.alistapart.com/articles/fauxcolumns/
moff
hate to break it to ya, but that never worked either lol.. www.littledesignplanet.co.uk/its
To be honest, I've got no idea of how to achieve this. However, what you're looking for is "equal-height columns", so you could play around with a Google search if you want to :)
moff
Ye hehe thanks matey... I will play around, thanks for your help too.