I have a div (maincontent) which is inside another div (container). These divs are located in aspx page, and I have many asp.net controls inside the insider div (maincontent). But it is so interesting that the site looks like this;

https://i.stack.imgur.com/omahx.jpg
The white part (maincontent) should be resized according to the elemnts inside. But it’s height is shown as 0px.
Here is the css of maincontent and container;
#container
{
background: #FFF;
width: 1000px;
height:auto;
margin-right: auto;
margin-left: auto;
border-right: 2px solid #B0AA94;
border-left: 2px solid #B0AA94;
border-bottom: 2px solid #B0AA94;
border-radius: 0px 10px 0px 10px;
}
#maincontent
{
height: auto;
font-family: Trebuchet MS;
font-size: 10px;
color: Black;
margin-left: 30px;
margin-top: 40px;
}
What am I missing ?
You likely have a lot of floated elements within those containers. You’ll need to clear them. You can clear floated elements by setting their container’s overflow property to “auto” or “hidden”.
Fiddle: http://jsfiddle.net/JyAMb/