日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

CSS HACK收集:關(guān)于IE6/FF/google等瀏覽器hack的方法詳細(xì)

一、IE6 下
a標(biāo)簽嵌套img標(biāo)簽IE下會(huì)有邊框,那是超鏈接默認(rèn)的樣式,解決辦法:img{border:0 none;}
1、終極方法:條件注釋
!--[if lte IE 6] 這段文字僅顯示在 IE6及IE6以下版本 。![endif]--
!--[if gte IE 6] 這段文字僅顯示在 IE6及IE6以上版本 。![endif]--
!--[if gt IE 6] 這段文字僅顯示在 IE6以上版本(不包含IE6) 。![endif]--
!--[if IE 5.5] 這段文字僅顯示在 IE5.5 。![endif]--
!--在 IE6及IE6以下版本中加載css--
!--[if lte IE 6] link type=text/css rel=stylesheet href=https://www.rkxy.com.cn/dnjc/css/ie6.css mce_href=css/ie6.css /![endif]--
缺點(diǎn)是在IE瀏覽器下可能會(huì)增加額外的HTTP請求數(shù) 。
2、CSS選擇器區(qū)分
IE6不支持子選擇器;先針對IE6使用常規(guī)申明CSS選擇器,然后再用子選擇器針對IE7 及其他瀏覽器 。
/* IE6 專用 */
.content {color:red;}
【CSS HACK收集:關(guān)于IE6/FF/google等瀏覽器hack的方法詳細(xì)】/* 其他瀏覽器 */
divp .content {color:blue;} --
3、PNG半透明圖片的問題
雖然可以通過JS等方式解決,但依然存在載入速度等問題,所以,這個(gè)在設(shè)計(jì)上能避免還是盡量避免為好 。以達(dá)到網(wǎng)站最大優(yōu)化 。
4、IE6下的圓角
IE6不支持CSS3的圓角屬性,性價(jià)比最高的解決方法就是用圖片圓角來替代,或者放棄IE6的圓角 。
5、IE6背景閃爍
如果你給鏈接、按鈕用CSS sprites作為背景,你可能會(huì)發(fā)現(xiàn)在IE6下會(huì)有背景圖閃爍的現(xiàn)象 。造成這個(gè)的原因是由于IE6沒有將背景圖緩存,每次觸發(fā)hover的時(shí)候都會(huì)重新加載,可以用JavaScript設(shè)置IE6緩存這些圖片:
document.execCommand(BackgroundImageCache,false,true);
6、最小高度
IE6 不支持min-height屬性,但它卻認(rèn)為height就是最小高度 。解決方法:使用ie6不支持但其余瀏覽器支持的屬性!important 。
#container {min-height:200px; height:auto !important; height:200px;}
7、最大高度
//直接使用ID來改變元素的最大高度
var container = document.getElementById(’container’);
container.style.height = (container.scrollHeight199) ? 200px : auto;
//寫成函數(shù)來運(yùn)行
function setMaxHeight(elementId, height){
var container = document.getElementById(elementId);
container.style.height = (container.scrollHeight(height - 1)) ? heightpx : auto;
}
//函數(shù)示例
setMaxHeight(’container1’, 200);
setMaxHeight(’container2’, 500);
8、100% 高度
在IE6下,如果要給元素定義100%高度,必須要明確定義它的父級元素的高度,如果你需要給元素定義滿屏的高度,就得先給html和body定義height:100%; 。
9、最小寬度
同max-height和max-width一樣,IE6也不支持min-width 。
//直接使用ID來改變元素的最小寬度
var container = document.getElementById(’container’);
container.style.width = (container.clientWidthwidth) ? 500px : auto;
//寫成函數(shù)來運(yùn)行
function setMinWidth(elementId, width){
var container = document.getElementById(elementId);
container.style.width = (container.clientWidthwidth) ? widthpx : auto;
}
//函數(shù)示例
setMinWidth(’container1’, 200);
setMinWidth(’container2’, 500);
10、最大寬度
//直接使用ID來改變元素的最大寬度
var container = document.getElementById(elementId);
container.style.width = (container.clientWidth(width - 1)) ? widthpx : auto;
//寫成函數(shù)來運(yùn)行
function setMaxWidth(elementId, width){
var container = document.getElementById(elementId);
container.style.width = (container.clientWidth(width - 1)) ? widthpx : auto;
}
//函數(shù)示例
setMaxWidth(’container1’, 200);
setMaxWidth(’container2’, 500);
11、雙邊距Bug
當(dāng)元素浮動(dòng)時(shí),IE6會(huì)錯(cuò)誤的把浮動(dòng)方向的margin值雙倍計(jì)算 。個(gè)人覺得較好解決方法是避免float和margin同時(shí)使用 。

推薦閱讀