I am very bad at CSS. I want to resize the parent div based on height of child div. Below is my html code.

```
<div id="mainPanel" class="tabPanel">
     <div class="ui-corner-all ui-widget-content grid_container" style="padding: 5px; margin: 5px; text-align: left;">
         <div align="left">
            <div id="subTabs" style="width:500px">
               <div class="ui-layout-content">
                  <div id="Form1">
                   </div>

                   <div id="Form2">
                   </div>
               </div>
            </div>
         </div>
      </div>
  </div> 

```

Inside form1 and form2 div's I am dynamically populating components which may grow till any height. I tried with overflow:auto in all the parent div's , but no luck. Any help will really appreciated.