IE6支持max-width/height與min-width/height(完美解決方案)
發(fā)布時(shí)間:2013-03-22 16:12:38 作者:佚名
我要評(píng)論

IE6支持最大寬度,IE6支持最小寬度以及讓IE6支持min-width同時(shí)又支持max-width解決方案,代碼很簡(jiǎn)潔功能很實(shí)用,有需求的朋友可以參考下哈,希望可以幫助到你
1、IE6支持max-width解決方法 IE6支持最大寬度,解決CSS代碼:
.className {
max-width:1000px;
_width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1000?"1000px":"");
overflow:hidden;
}
說(shuō)明:max-width:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最大范圍寬度。
而_width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1000?"1000px":"");overflow:hidden;
則是讓IE6支持max-width替代CSS代碼,但效果和其它版本瀏覽器相同效果。讓所有瀏覽器都支持max-width的CSS樣式代碼,完整:
max-width:1000px;_width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1000?"1000px":"");overflow:hidden;
這里的1000和1000px是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。設(shè)置最大max-width的時(shí)候別忘記加上overflow:hidden;
2、IE6支持min-width解決方法 IE6支持最小寬度,解決CSS代碼:
.className {
min-width:1000px;
_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>1000?"1000px":"");
}
說(shuō)明:min-width:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最大范圍寬度。
而_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>1000?"1000px":"");
則是讓IE6支持min-width替代CSS代碼,但效果和其它版本瀏覽器相同效果。讓所有瀏覽器都支持min-width的CSS樣式代碼,
完整: min-width:1000px;_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>1000?"1000px":"");
這里的1000和1000px是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。
3、讓IE6支持min-width同時(shí)又支持max-width解決方法讓IE6即支持最小寬度又支持最大寬度限制設(shè)置。
這種情況我們常常碰到對(duì)圖片控制,讓不確定大小的圖片,如果太寬,不能超出一定范圍值,小的時(shí)候不控制他的方法,用到CSS代碼:
_width:expression(this.scrollWidth > 620 ? "620px" : (this.scrollWidth < 1? "1px" : "auto"));
對(duì)圖片控制CSS完整代碼: img{max-width:620px;_width:expression(this.scrollWidth > 620 ? "620px" : (this.scrollWidth < 1? "1px" : "auto"));}
這里說(shuō)明:圖片不能超出大于620px的寬度,又不小于1像素的寬度。
讓所有瀏覽器包括IE6瀏覽器支持最大寬度又支持最小寬度DIV CSS代碼:
.className {
max-width:620px;
min-width:1px;
_width:expression(this.scrollWidth > 620 ? "620px":(this.scrollWidth < 1? "1px":"auto"));
}
1、IE6支持max-height解決方法 IE6支持最大高度解決CSS代碼:
.className{
max-height:1000px;
_height:expression((document.documentElement.clientHeight||document.body.clientHeight)<1000?"1000px":"");
overflow:hidden;
}
說(shuō)明:max-height:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最大范圍高度。
而_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是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。讓IE6支持最大高度max-height的時(shí)候別忘記加上overflow:hidden;
2、IE6支持min-height解決方法 IE6支持最小高度解決CSS代碼:
.className {
min-height:1000px;
_height:expression((document.documentElement.clientHeight||document.body.clientHeight)>1000?"1000px":"");
}
說(shuō)明:min-height:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最小范圍高度。
而_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是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。
3、IE6支持max-height又支持min-height方法讓所有瀏覽器包括IE6即支持最大高度又支持最小高度。
.className {
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"));
說(shuō)明:以上代碼作用是讓對(duì)象的最小高度為40px,最大高度為620px的CSS樣式屬性
復(fù)制代碼
代碼如下:.className {
max-width:1000px;
_width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1000?"1000px":"");
overflow:hidden;
}
說(shuō)明:max-width:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最大范圍寬度。
而_width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1000?"1000px":"");overflow:hidden;
則是讓IE6支持max-width替代CSS代碼,但效果和其它版本瀏覽器相同效果。讓所有瀏覽器都支持max-width的CSS樣式代碼,完整:
max-width:1000px;_width:expression((document.documentElement.clientWidth||document.body.clientWidth)<1000?"1000px":"");overflow:hidden;
這里的1000和1000px是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。設(shè)置最大max-width的時(shí)候別忘記加上overflow:hidden;
2、IE6支持min-width解決方法 IE6支持最小寬度,解決CSS代碼:
復(fù)制代碼
代碼如下:.className {
min-width:1000px;
_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>1000?"1000px":"");
}
說(shuō)明:min-width:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最大范圍寬度。
而_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>1000?"1000px":"");
則是讓IE6支持min-width替代CSS代碼,但效果和其它版本瀏覽器相同效果。讓所有瀏覽器都支持min-width的CSS樣式代碼,
完整: min-width:1000px;_width:expression((document.documentElement.clientWidth||document.body.clientWidth)>1000?"1000px":"");
這里的1000和1000px是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。
3、讓IE6支持min-width同時(shí)又支持max-width解決方法讓IE6即支持最小寬度又支持最大寬度限制設(shè)置。
這種情況我們常常碰到對(duì)圖片控制,讓不確定大小的圖片,如果太寬,不能超出一定范圍值,小的時(shí)候不控制他的方法,用到CSS代碼:
_width:expression(this.scrollWidth > 620 ? "620px" : (this.scrollWidth < 1? "1px" : "auto"));
對(duì)圖片控制CSS完整代碼: img{max-width:620px;_width:expression(this.scrollWidth > 620 ? "620px" : (this.scrollWidth < 1? "1px" : "auto"));}
這里說(shuō)明:圖片不能超出大于620px的寬度,又不小于1像素的寬度。
讓所有瀏覽器包括IE6瀏覽器支持最大寬度又支持最小寬度DIV CSS代碼:
復(fù)制代碼
代碼如下:.className {
max-width:620px;
min-width:1px;
_width:expression(this.scrollWidth > 620 ? "620px":(this.scrollWidth < 1? "1px":"auto"));
}
1、IE6支持max-height解決方法 IE6支持最大高度解決CSS代碼:
復(fù)制代碼
代碼如下:.className{
max-height:1000px;
_height:expression((document.documentElement.clientHeight||document.body.clientHeight)<1000?"1000px":"");
overflow:hidden;
}
說(shuō)明:max-height:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最大范圍高度。
而_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是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。讓IE6支持最大高度max-height的時(shí)候別忘記加上overflow:hidden;
2、IE6支持min-height解決方法 IE6支持最小高度解決CSS代碼:
復(fù)制代碼
代碼如下:.className {
min-height:1000px;
_height:expression((document.documentElement.clientHeight||document.body.clientHeight)>1000?"1000px":"");
}
說(shuō)明:min-height:1000px; 這個(gè)是IE6以上級(jí)其它品牌瀏覽器支持最小范圍高度。
而_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是你需要的數(shù)值,注意3個(gè)數(shù)值的相同。
3、IE6支持max-height又支持min-height方法讓所有瀏覽器包括IE6即支持最大高度又支持最小高度。
復(fù)制代碼
代碼如下:.className {
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"));
說(shuō)明:以上代碼作用是讓對(duì)象的最小高度為40px,最大高度為620px的CSS樣式屬性
相關(guān)文章
兼容IE6、IE7的min-width、max-width寫(xiě)法
這篇文章主要介紹了兼容IE6、IE7的min-width、max-width寫(xiě)法,需要的朋友可以參考下2016-01-13讓IE6支持兼容min-width、max-width CSS樣式屬性的方法
這篇文章主要介紹了讓IE6支持兼容min-width、max-width CSS樣式屬性的方法,需要的朋友可以參考下2016-01-13