客服QQ:116364071
群交流:6048697

您当前位置:首页 >> web标准 >> IE6环境下使用min-height的方法

IE6环境下使用min-height的方法

更新时间:2007-12-19参与评论

前段时间写有一篇“在IE6环境下使用min-width的方法”,得到众人批评,呵呵,确实只是研究而已,不怎么实用。
min-height实现起来相对容易,cssplay上已经给出了方法:
/*for understanding browsers */
.container { width:20em; padding:0.5em; border:1px solid #000; min-height:50px; height:auto;}
/* for Internet Explorer */
/*\*/
* html .container{height:50px;}
/**/
在IE环境下,其实height就几乎就等于是min-height,指定容器高度后,当内容撑大时有自动延伸的特质。在FF内不会,而是显示固定height值。
min-height:8em;在IE下不做解析,height:8em; 是专为IE定义的,height:auto;应该是兼容性定义。
.beispieldiv{ min-height:150px; height:auto;background:#f00;}
* html .beispieldiv { height:150px; } /* nur für IE 5.5 - 6.x */
html + body .beispieldiv { height:150px; } /* nur vom IE 5.0 */
效果演示:http://www.rexsong.com/blog/attachments/200512/14_104006_minheight.htm