IE6支持min-height,max-height等的方法

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:620px;Min-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樣式屬性


發佈了115 篇原創文章 · 獲贊 42 · 訪問量 68萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章