CSS DIV not expanding when more text is added

Posted by decbrad on Stack Overflow See other posts from Stack Overflow or by decbrad
Published on 2010-04-10T14:34:48Z Indexed on 2010/04/10 14:43 UTC
Read the original article Hit count: 338

Filed under:
|
|

Hi there...

I have a quick CSS question, i'm hoping that somebody can help me out!

I have a DIV called #ContentPanel and I want it to be able to expand so that it can cater for more text if needed. At the moment if the text is longer than 500px (as specified in the CSS) it flows out the bottom and over the content in the div below. How can I set it up to auto expand and push all divs after downwards.

If anybody has any ideas, please let me know

Here's the HTML

<div id="MainContent">
    <div id="MainImage"></div>
    <div id="ContentPanel">Text content goes here.</div>
</div>

...and here's the CSS

#MainContent {
    position:relative;
    height:500px;
    width:800px;
    margin:0 auto;
    background-color: #000;
}

#MainImage {
    position:absolute;
    top:0;
    left:0;
    width:350px;
    height:500px;
    background-color:#000;
}

#ContentPanel {
    position:absolute;
    height:500px;
    top:0;
    left:350px;
    width:450px;
    background-color:#000;
}

Thanks in advance!

Kind regards,

Decbrad

© Stack Overflow or respective owner

Related posts about css-layout

Related posts about div