Solved

Adjust height of container DIV to inside DIVS

Posted on 2009-07-07
2
638 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:
renazonse 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Centering a div in html5 5 47
Remove 'disabled' attribute 6 27
Responsive CSS question 2 39
CSS measurement 10 13
"I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now