tags:

views:

326

answers:

2

Hi,

I'm trying to create a two column layout with a footer. Till now the result is headache ;-) Actually I'm not very experienced with css. I prefer to implement the business logic.

In the actual layout I have a problem that the right column will be placed under the left column after the left column is finished. I'm dealing with this topic now for days and it seems like I need the help from some really experienced css experts. For them this task is probably a work of minutes.

I uploaded a simplied version of the page and you see, the grey column on the left does not grow bigger when the filters in the right column are opened. As a result the table of the right column is placed below the left column. I tried to fix it with relative or absolute positioning of the left or right column. But then the foote does not move down when the size of the right column grows and consequently they overlap.

Hope to find some help here. Thank in advance.

Here you can find the page: link

The columns are defined in the structure.css . The things to look at are

_#container .c_left
_#container .c_right
#container .c_footer

Edit: The problem occurs in each browser. Thus no IE6 problem. Definitely a design bug.

+1  A: 

[deleted my bullet points - it's best demonstrated in html!]

Here's an html snippet that you can adapt to fit as required:

<body> 
<div style="min-width:400px;">
<div style="float:left; background:red;height:200px; width:200px;">left column</div> 
<div style="overflow:hidden; height:300px; background:blue; color:white;">right column</div> 
<div style="clear:both">&nbsp;</div> 
<div style="background:black;color:white">footer</div> 
</div>
</body> 

I've given the divs different heights just to demonstrate the effect of the clear div forcing the footer to be pushed down.

Andras Zoltan
Thanks, i tried first your 4 bullets. Actually the problem would be gone, but now the right colum is floated to the right. All the content of the right column is now on the right end of the page. This is not what I wanted to achieve. Did I make something wrong?
Tom Tom
No you didn't do anything wrong! You have a couple of choices here, you can either float:left the right column as well (so both DIVs stack up on the left of each other); or you can place both DIVs inside another DIV container that you give an explicit width too. Float:left * 2 might be your best bet. I've updated the example and answer to demonstrate.
Andras Zoltan
Just that you see the result for the first try: http://mocaso.vs120027.hl-users.com/website/v2/ContactFilter.htm
Tom Tom
With your actual example. I will try it out in a minute. But don't you think I will get the same problem with content of the right column will be placed below the left column if the left column is "over"?.
Tom Tom
i suggest you attach a dummy screen shot about what you want to do?
joetsuihk
Please see http://mocaso.vs120027.hl-users.com/website/Contact%20Filter.htm . This is actually what I want to do, but without the bug that the content of the right will be placed below the left content when the right columns grows in size.
Tom Tom
@Andras Zoltan: Your example code works, even when the content of the column on the right grows in size. I think I will try to clean up my stuff and implement as you suggested. Could last some hours ;-) I'm wondering whats wrong in my code.
Tom Tom
Ok maybe it does not work for the purpose that I have. See http://mocaso.vs120027.hl-users.com/website/v3/testcss.html If you shrink the browser the right div is placed below the left div. This is not what should happen.
Tom Tom
I see what you mean - I'll hack about and update the example.
Andras Zoltan
Thanks a lotfor your effort!
Tom Tom
No probs - Please see updated answer - if you don't float the right column at all, and set overflow:hidden, then it automatically fills the contents of the <i>new</i> containing DIV; because it's not floated, either, the browser won't reposition when things get too small. I've also put a min-width on the containing div to show how you can prevent nasty edge cases in layout caused by the user reducing the size of the browser. However - you are undoubtedly going to get evils from certain browsers!
Andras Zoltan
That seems to work :D What do you mean with "you are undoubtedly going to get evils from certain browsers". I tried this solution in firefox, ie6 and chrome. Seems to work in all of them. I'm not a native speaker.
Tom Tom
Do you think the overflow:hidden is a problem for certain browsers?
Tom Tom
because, when it comes to web pages and CSS etc, I always expect the worst - so many situations where I've been left angry by different browsers' reactions to my markup! However, if it works in those three; it looks like we might have a solution :)
Andras Zoltan
:D haha.. yeah you are right. Same thing here. I started to expect the worst. Often I m like "yeeess. great..i found a solution" and after two seconds "ooooh nooo" ;-) Anyway.. thanks a lot for your help! I really appreciate it. Especially since I'm dealing with this topic now for days and now I can fully enjoy the weekend without headache.
Tom Tom
no probs - enjoy the weekend :D
Andras Zoltan
A: 

please state your browser and version number when you ask CSS questions.

i think the problem happens in IE6? declare the right column float left, while add an empty div with clear:both after right column div.

<div class="left-col">abc</div>
<div class="right-col">def</div>
<div style="clear:both;"></div>

there is some more things you need to know, IE6 do not support min-height, use height instead or do not declare height at all.

Welcome to the IE6 hell.

joetsuihk
Next time I will. But for this case the problem does occur in each browser. So I can not blame the beast (IE6)!
Tom Tom