Forum Moderators: not2easy

Message Too Old, No Replies

Make columns stay put!

Why do they stack when browser resized?

         

ChristiMc

5:35 am on Nov 22, 2004 (gmt 0)

10+ Year Member



I have a 2 column CSS page that has navigation on the left and content on the right. All that is fine. But when I view the page with the browser NOT maximized, the right column bumps down below the left column.

Is there any way to force the right column to stay put?

Thanks for any insight! This forum is a lifeline to me!

Christi

BonRouge

1:05 pm on Nov 22, 2004 (gmt 0)

10+ Year Member



Well, my guess is that you're floating both of the columns (maybe left to the left and right to the right).
If you float the right one to the right but let the one on the left sit there naturally in the flow of the document, you might be OK.

(This is mostly guesswork though if I don't see your code).

I hope this helps.

createErrorMsg

2:22 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any way to force the right column to stay put?

I would need to see your code to be sure, but chances are you're using a relative width on the container div (or no container div at all). When two adjacent floats cannot fit inside of their container's width, the second one bumps down below the first.

Either (a) apply a fixed width to the container that is just slightly larger than the combined width of the floats or (b) relatively size the floats (a bad idea, IMO).

cEM

DrDoc

2:56 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can also use a left margin on your content div (it doesn't need to be floated anymore), and then use absolute (or relative) positioning to get the navigation div to appear in the right place. This method would even allow you to put the content div first in the source code, which is a bonus.

ChristiMc

4:57 pm on Nov 22, 2004 (gmt 0)

10+ Year Member



As usual, my problems are resolved as a result of this forum.

I ended up using createErrorMsg solution. I did NOT have a container div around the navigation and content divs so I did that and all works well.

I tried DrDoc's suggestion but haven't been able to get that to work yet but I'll keep trying just to have that in my bag of tricks.

Last question, more for learning than anything, DrDoc, you said that having the content div at the top of the code is a bonus, is that just because it's easier to find and edit the content if it is at the top of the code or is there some other benefit that you are referring to?

Thanks again!

DrDoc

7:17 am on Nov 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It helps the SE spiders to find your content more easily. Now, that's not to say that putting the content first will magically boost your SE rankings. It may make a slight difference, but it also might not. But, at least it is one more brick in the bucket to help improve the rankings. One thing's for sure -- it won't hurt!

ChristiMc

3:32 pm on Nov 23, 2004 (gmt 0)

10+ Year Member



Thanks DrDoc. I'll tuck that away in my memory banks!