Solved

Adjust height of container DIV to inside DIVS

Posted on 2009-07-07
2
647 Views
Last Modified: 2012-05-07
Experts,

I have a container DIV, div.container with two contained DIVS, div.navigation and div.content.  I'd like to expand the container DIV to the height of the inside DIVS.  My content div has dynamic text of a varied length, and the container has a static white background.  

please could someone point me to the correct CSS code for these elements to achieve this.

I've included what I have below
div.container {
   width:900px;
   text-align:left;
   margin:0px;
   background-color:#FFFFFF;
}
div.navigation {
   width:200px;
   float:left;
   margin:0px;
}
div.content {
   width:700px;
   float:left;
   margin:0px
}

Open in new window

0
Comment
Question by:nickmarshall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
Britt Thompson earned 500 total points
ID: 24792846
your html will help but it sounds like you may need to do something like this. If I'm way off you'll need to post more code.

<div class="container">
<div class="navigation"></div>
<div class="content"></div>
<div style="clear:both;"></div> <!--THIS WILL PUSH DOWN THE CONTAINER WITH THE CONTENT-->
</div>
0
 
LVL 7

Expert Comment

by:Valleriani
ID: 24792913
I'm new myself but wouldn't doing it this way have the similar effect?

div.container {
   width:900px;
   text-align:left;
   margin:0px;
   background-color:#999999;
}
div.navigation {
   width:200px;
   float:left;
   margin:0px;
}
div.content {
   width:700px;
   margin:0px;
   margin-left:200px;
}

       <div class=container>
                        <div class=navigation>
                        LINKS HERE
            </div>
            <div class=content>
                         CONTENT HERE
            </div>
             </div>

Note I used a different color background just so you can see the 'container' box
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question