?
Solved

Adjust height of container DIV to inside DIVS

Posted on 2009-07-07
2
Medium Priority
?
651 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 2000 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 Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
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 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…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

771 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