1

I am trying to make two divs in the main container side by side, with bottom div should adapt to the width of the rest of the space.

<div id="container">
    <div id="left">fixed width</div>
    <div id="right">rest of space width</div>
</div>

#container {
    float:left;
    width:100%;
}
#left, #right {
    padding:50px;
    background: #ccc;
    vertical-align: bottom;
    display: inline-block;
    /* ie6/7 */
    *display: inline;
    zoom: 1;
}

#right {
    padding:20px;
    background:#000;
    color:#fff;
} 

I'm stuck at this stage http://jsfiddle.net/Z9qW3/7/

david
  • 3,225
  • 9
  • 30
  • 43
Megadevice
  • 23
  • 1
  • 8

4 Answers4

1
#container
{
   overflow-x:hidden
}
#left
{
width:20%;
float:left;
position:fixed;
border:1px solid red
}
#right
{
width:80%;
float:right;
position:absolute;
left:20%;
bottom:0;
border:1px solid red
}
0

Try This Code:

Demo

css

#left
{
width:20%;float:left;position:fixed;left:0px;
border:1px solid yellow;
}
#right
{
width:80%;float:right;
border:1px solid red;
}

html

<div id="container">
    <div id="left">fixed width</div>
    <div id="right">rest of space width</div>
</div>
Sandip
  • 372
  • 1
  • 7
  • and how to fix problem that my right div is still in top position? i need move my right div to bottom position. – Megadevice Sep 26 '13 at 08:43
  • @Megadevice check this [link](http://jsfiddle.net/A2she/2/) – Sandip Sep 26 '13 at 08:48
  • it's not excatly what i meant. look at my first post. i want only stretch my right div to rest of width and i can't do it because if i stretch my div it back to top position. – Megadevice Sep 26 '13 at 08:56
0

Hope this would help...

#container {
    width: 100%;
}

#left {
    padding: 50px;
    background: #ccc;
    vertical-align: bottom;
    display: inline-block;
    /* ie6/7 */
    *display: inline;
    zoom: 1;
    float:left;
}

#right {
    padding-top: 20px;
    padding-bottom: 20px;    
    background:#000;
    color:#fff;
    width: 79%;
    float: right;    
} 
Mahib
  • 3,977
  • 5
  • 53
  • 62
-1

What i can get from your question is you want a fixed div on left side and the other div should take the remaining space on right and on the bottom of left div. I think a better approach would be to make a single big div and then float a fixed div on left and then you can use the remaining portion to position individual elements with css positioning property

Mandeep
  • 9,093
  • 2
  • 26
  • 36