要定义一个最小高度为600px的div,可以这样写:
{height:auto !importantheight:600pxmin-height:600px}
则div在IE与firefox中都会有一个最小高度,且高度会自适应内容的长度。
希望我的回答对您有所帮助,如有疑问,欢迎继续在本平台咨询。
了解更多火狐浏览器的使用小技巧,请到火狐社区:http://mozilla.com.cn/moz-portal.html
感谢您对火狐浏览器的支持!
1、IE6支持max-height解决方法IE6支持最大高度解决CSS代码:
.yangshi{max-height:1000px_height:expression((document.documentElement.clientHeight||document.body.clientHeight)<1000?"1000px":"")overflow:hidden}
说明:max-height:1000px这个是IE6以上级其它品牌浏览器支持最大范围高度。而_height:expression((document.documentElement.clientHeight||document.body.clientHeight)<1000?"1000px":"")overflow:hidden则是让IE6支持max-height替代CSS代码,但效果和其它版本浏览器相同效果。
让所有浏览器都支持max-height的CSS样式代码,完整:
max-height:1000px_height:expression((document.documentElement.clientHeight||document.body.clientHeight)<1000?"1000px":"")overflow:hidden这里的1000和1000px是你需要的数值,注意3个数值的相同。
让IE6支持最大高度max-height的时候别忘记加上overflow:hidden
2、IE6支持min-height解决方法
IE6支持最小高度解决CSS代码:
.yangshi{min-height:1000px_height:expression((document.documentElement.clientHeight||document.body.clientHeight)>1000?"1000px":"")}
说明:min-height:1000px这个是IE6以上级其它品牌浏览器支持最小范围高度。而_height:expression((document.documentElement.clientHeight||document.body.clientHeight)>1000?"1000px":"")则是让IE6支持min-height替代CSS代码,但效果和其它版本浏览器相同效果。
让所有浏览器都支持min-height的CSS样式代码,完整:
min-height:1000px_height:expression((document.documentElement.clientHeight||document.body.clientHeight)>1000?"1000px":"")这里的1000和1000px是你需要的数值,注意3个数值的相同。
3、IE6支持max-height又支持min-height方法
让所有浏览器包括IE6即支持最大高度又支持最小高度。
.yangshi{Max-Height:620pxMin-Height:40px_height:expression(this.scrollHeight >620 ? "620px" : (this.scrollHeight <40 ? "40px" : "auto"))}
IE6支持Max-Height和支持Min-Height CSS代码
_height:expression(this.scrollHeight >620 ? "620px" : (this.scrollHeight <40 ? "40px" : "auto"))
说明:以上代码作用是让对象的最小高度为40px,最大高度为620px的CSS样式属性
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.a1 {
width: 200px
border-bottom-width: 1px
border-bottom-style: solid
border-bottom-color: #0066FF
}
-->
</style>
</head>
<body>
<div class="a1">无标题文档无标文档无标题文档无标题文档</div>
<div class="a1">无标题文档无标题文档无标题文档无标题文档无标题文档</div>
<div class="a1">无标题文档无标题文档无标题文档无标题文档</div>
<div class="a1">无标题文档无档无标题文档无标题文档</div>
<div class="a1">无标题文档无标题文档无标题文档无标题文档无标题文档</div>
<div class="a1">无标题文档无标题文文档无标题文档无标题文档</div>
</body>
</html>