tags:

views:

24

answers:

2

I've got two-column layout

 <div class="left-pane">
        Left pane
    </div>
    <div class="central-pane">
        <div>
            <ul class="customers-types-tabs">
                <li>item 1</li>
                <li>item 2</li>
                <li>item 3</li>
            </ul>
        </div>
        <div>Main content</div>
    </div>

and the stylesheet:

.left-pane {
    width: 248px;
    float: left;
    background-color: #f6f6f6;
    border: 1px solid #e6e6e6;
    padding: 20px 5px;
}
.central-pane {
    margin-left: 270px;
}
.customers-types-tabs li {
    background-color: #f6f6f6;
    border: 1px solid #d5d5d5;
    line-height: 38px;
    padding: 0 20px;
    float: left;
    margin-right: 10px;
    position: relative;
    top: 1px;
}

The problem is that I want "Main content" to appear right below the div with ul inside it (that represents tabs control), but if I set Main content's div's style to clear: both, it appears below the left pane, which is taller than the ul. What should I do to get correct position of main content?

+1  A: 

give the central pane also a float: left

and the next element after this construct you give float:none;

and if you want to be shure it works on any browserwindow size put a div around all that with fied width, so that the inner objects fit into it by width. know what i mean?#

 <div id="wrapper">
 <div class="left-pane">
         Left pane
     </div>
     <div class="central-pane">
         <div>
             <ul class="customers-types-tabs">
                 <li>item 1</li>
                 <li>item 2</li>
                 <li>item 3</li>
             </ul>
         </div>
         <div id="main">Main content</div>
     </div> 
 </div>
 <div style="flaot:none;"></div>

and the stylesheet:

#wrapper{
  position: relative;
  width: 548px;
}

.left-pane {
    width: 248px;
    float: left;
    ...
}
.central-pane {
    float: left;
    width: 200px;
}
#main{
    width: 100px;
    float: left;
    ...

}

now they should apear each next to the other

helle
not tested yet, but used often ;-)maybe you have to check heights ...
helle
But I need central pane to occupy all free space to the right of left pane, and if I set float: left to central pane, its width is defined by its content, but not by the free space. What can I do about it?
HiveHicks
which of those have to have a dynamic width?
helle
<div class="central-pane">
HiveHicks
depending on the content??
helle
It fills all free space unless I set it's float to left. I need to preserve this behaviour.
HiveHicks
So long I found one solution, but it's not "pretty". Adding <li style="float: none; visibility: hidden;">stub</li> as the last item to ul helps solve the problem.
HiveHicks
A: 

So long I found one solution, but it's not "pretty". Adding

<li style="float: none; visibility: hidden;">stub</li>

as the last item to ul helps solve the problem.

HiveHicks