Solved

Adjust height of container DIV to inside DIVS

Posted on 2009-07-07
2
645 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
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

685 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