views:

35

answers:

2

I'm experimenting with DIVs to align my page's contents: http://labs.pieterdedecker.be/test/test.htm

As you can see, there's something wrong with the sidebar. I got the sidebar DIV to be aligned to the right of the page by doing float: right, but when the text in the sidebar stops the main area takes over the width that should be used by the sidebar.

How do I fix this?

A: 

You give the main area a width.

Josh K
That fixes the width stealing, but it still leaves the sidebar border halfway the page.
Pieter
Right, so now start a different question about the border.
Josh K
@Josh K, or just look for existing SO questions about css equal height columns, or some variation thereof. I imagine there's quite a few already, without adding more.
David Thomas
There are tons.
Josh K
+1  A: 

Hi, I supose what you want to accomplish is to separate the #body div in 2 columns. First of all it will be easier if you package main column in its own div like this:

<div id="body">
    <div id="sidebar">lorem ipsum...</div>
    <div id="main">lorem ipsum...</div>
</div>

and then give #main div a width.

If you need to preserve your markup, then ALL #body elements other than #sidebar must have a width.

Another solution that would work if page is static and it's content will not "grow" is to set a big-enough heigth to the sidebar...

maybe what you are looking for is equal height columns... there are some differente method to do this... just google for it or take a look at this: http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks

maid450