eth*_*eal 35
遗憾的是IE6没有这样你必须使用IE6的表达式,然后为所有其他浏览器设置max-height:
div{
_height: expression( this.scrollHeight > 332 ? "333px" : "auto" ); /* sets max-height for IE6 */
max-height: 333px; /* sets max-height value for all standards-compliant browsers */
overflow:scroll;
}
Run Code Online (Sandbox Code Playgroud)
溢出:在大多数情况下,auto很可能会因为任何额外的溢出而起作用.
Mot*_*tie 16
我从2005年的一篇文章(Min-Height Fast hack)中找到了这个解决方案.这是一个黑客,但它是简单而纯粹的CSS:
selector {
max-height:500px;
height:auto !important;
height:500px;
}
Run Code Online (Sandbox Code Playgroud)
该示例适用于最大高度,但适用于最小高度,最小宽度和最大宽度.:)
*注意:您必须使用绝对值,百分比不起作用.
你现在需要的只是"溢出:滚动;" 使用滚动条使这个工作
小智 8
selector
{
max-height:900px;
_height:expression(this.scrollHeight>899?"900px":"auto");
overflow:auto;
overflow-x:hidden;
}
Run Code Online (Sandbox Code Playgroud)