热门关键字:
jquery > jquery教程 > div+css > 让IE6也支持max-height,min-height

让IE6也支持max-height,min-height

2451
作者:管理员
发布时间:2012/7/25 22:39:52
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=12
 
 
1、IE6支持max-height解决方法 IE6支持最大高度解决CSS代码:
 
  1. .className{   
  2.     max-height:1000px;   
  3.     _height:expression((document.documentElement.clientHeight||document.body.clientHeight)<1000?"1000px":"");   
  4.     overflow:hidden;   
  5. }  
说明: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代码:
 
  1. .className {   
  2.     min-height:1000px;   
  3.     _height:expression((document.documentElement.clientHeight||document.body.clientHeight)>1000?"1000px":"");   
  4. }  
说明: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即支持最大高度又支持最小高度。
 
  1. .className {   
  2.     Max-Height:620px;   
  3.     Min-Height:40px;   
  4.     _height:expression(this.scrollHeight > 620 ? "620px":(this.scrollHeight < 40 ? "40px":"auto"));   
  5. }  
IE6支持Max-Height和支持Min-Height CSS代码 _height:expression(this.scrollHeight > 620 ? "620px" : (this.scrollHeight < 40 ? "40px" : "auto"));
 
说明:以上代码作用是让对象的最小高度为40px,最大高度为620px的CSS样式属性
 




如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:让IE6也支持max-height min-height
友荐云推荐