tags:

views:

37

answers:

3

Hi!

I have a 2 column layout that I'asked about earlier (http://stackoverflow.com/questions/3423761/simple-2-column-layout). What I've noticed is that it's not the positioning of the content column on the right that's the problem, but rather it's the way the content in that column is positioned.

I've been looking for a while and I can't see where the problem is. It looks as though the content in the right column has padding on it equal to the height of the left column.

Here's my css:

#wrapper { margin-left: 100px; width: 1000px; border-left: 1px solid #bcbcc6; border-right: 1px solid #bcbcc6; border-bottom: 1px solid #bcbcc6; }
/* Main page content, puts actual content and sidebar side-by-side */
#sidebar { float: left; padding: 5px; width: 189px; border-right: 1px solid #b6bcc6; }
#content { padding: 0 !important; margin: 0 0 0 200px; width: 790px; background-color: #ff00ff; }

EDIT: To see what's actually going on, you can check out http://www.logansarchive.za.net/bad.jpg and http://www.logansarchive.za.net/firebug.jpg I'm also going to add the page and style related files (stylesheet and images) as I have it so that you can inspect at your leisure: http://www.logansarchive.za.net/Default.aspx

+1  A: 

"Use Firebug" is generally not regarded a valid answer on SO, but it really is the best way to identify mystery paddings. Install it in your Firefox, right-click the element, and Firebug's Layout view will show you where it comes from.

Pekka
A: 

Have you tried making #content float:right

kuroutadori
`float: right;` just drops the whole column to the bottom of the bottom of other column. This has the effect of positioning the content correctly within #content, but it's still all at the bottom of the other column.
Logan Young
I am assuming the html code is `<div id="wrapper"><div id="sidebar"></di<div id="content"></div></div>` so, `#wrapper {width:100px margin:auto}; #sidebar{float:left margin:auto}; #content{float:left margin:auto};`Is the only other thing I can think of.
kuroutadori
+1  A: 

Inside your <div id="content"> you have a table with clear: both in its CSS, and then 2 divs with clear: left and clear: right on them respectively, which are breaking your floats. Removing all those clear properties in Firebug fixed it for me on your test page.

Will Prescott
ah fantastic :) thanks very much. Only problem now is that since there's more content in the sidebar on the left, my borders don't display right (bottom border intersects halfway up the left column
Logan Young
add `overflow: auto` to `#wrapper`
Will Prescott
absolute genius! Where can I learn? I use these things, but I generally have no clue what its all for...
Logan Young