CSS Expand Parent Div To Child Height

Posted by Steve Horn on Stack Overflow See other posts from Stack Overflow or by Steve Horn
Published on 2008-12-21T05:39:54Z Indexed on 2010/06/05 15:42 UTC
Read the original article Hit count: 333

Filed under:
|

I have a page structure similar to this:

<body>
<div id="parent">
    <div id="childRightCol">
    <div>
    <div id="childLeftCol">
    <div>
</div>
</body>

I would like for the parent div to expand in height when the inner div height expands.

Edit: One caveat is that if/when the width of the child content expands past the width of the browser window, my current CSS puts a horizontal scroll on the parent div. I would like the scrollbar to be at the page level. (Currently my parent div is set to overflow: auto;)

Can you please help me with the CSS for this?

© Stack Overflow or respective owner

Related posts about html

Related posts about css