*{font-size:12px; margin:0; padding:0;}
Method 1:
#testBox {border:1px solid #cccccc;p adding:5px;width:220px;
min-height:100px; /* Height minimum value set to: 100px*/
Height:auto!important; /* Compatible FF,IE7 also supports!important tags */
height:100px; /* Compatible with ie6*/
Method 2:
/* Use the following method alone can also be implemented */
Height:expression (This.height < 100?) "100px": this.height+ "px");
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<style type= "Text/css" >
*{font-size:12px; margin:0; padding:0;}
#testBox {border:1px solid #cccccc;p adding:5px;width:220px;
min-height:100px; /* Height minimum value set to: 100px*/
Height:auto!important; /* Compatible FF,IE7 also supports!important tags */
height:100px; /* Compatible with ie6*/
/* Use the following method alone can also be implemented */
/*height:expression (This.height < 100?) "100px": this.height+ "px"); */
}
</style>
<body>
<div id= "Testbox" >
<ul>
<!--only one record is the default height--
<li> here is the inside of each article ..... </li>
<!--The comment is deleted, the height increases with it.
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
<li> here is the inside of each article ..... </li>
-
</ul>
</div>
</body>
This article transferred from: http://www.cnblogs.com/hnyei/archive/2011/10/19/2217205.html
Fixed height div, automatically gets higher with content CSS definition method