0

This is my Html,

<div id="wrapper" class='common'>
    <div id="left" class='common'>Menu I Menu II Menu III Menu IV</div>
    <div id="right" class='common'>hello world..hello world..hello world..
      hello world..hello world..hello world..hello world..hello world..hello world..
      hello world..hello world..hello world..hello world..hello world..hello world..
      hello world..hello world..hello world..hello world..hello world..hello world..
      hello world..hello world..hello world..hello world..hello world..hello world..
      hello world..hello world..
    </div>
</div>

and this is my CSS,

#wrapper {
    overflow:hidden;
    padding:3px;
}
#right {
    float:right;
    width:70%;
}
#left {
    float:left;
    width:29%;
}
.common {
    border:solid 1px #000;
}

And here you can see the demo of it.

I am just trying to make the div with id left to be expandable based on the content of the div which is having the id right. i just tried to make that on my own but i failed. can anybody help me out by expelling some clues..?

Rajaprabhu Aravindasamy
  • 66,513
  • 17
  • 101
  • 130

4 Answers4

3

The most appropriate pure-css mechanism for doing this is through using display:table* to declare #left and #right as sibling columns. This will cause them to display as the same height when they are cast as display:table-cell. The only caveat is that you'll need one more wrapper div because a you need a structure that looks like display:table > display:table-row > display: table-cell.

I've added a jsfiddle here: http://jsfiddle.net/QDh59/

Ben D
  • 14,321
  • 3
  • 45
  • 59
0

If you want to use html css only, check this link:

http://css-tricks.com/fluid-width-equal-height-columns/

If you have no prob using javascript/jquery it would be much easier and more straightforward:

http://www.impressivewebs.com/equal-height-columns-with-javascript-full-version/

CMPS
  • 7,733
  • 4
  • 28
  • 53
0

I would suggest just using the height: attribute, with absolute positioning.

DEMO

Community
  • 1
  • 1
WASasquatch
  • 1,044
  • 3
  • 11
  • 19
0

Check this answer

I don't think it's easy to make 2 divs expand alone without wrapper like the answers you see in the links.

There are techniques like Faux Columns that can help you get what you asked for too and there are many other techniques.

Using CSS:

Faux Columns and CSS Table

Using Jquery:

Equalize Heights of Divs

Community
  • 1
  • 1
Abzoozy
  • 874
  • 12
  • 26