讓IE 6,7,8模擬部分的css3屬性
發(fā)布時(shí)間:2013-04-12 15:10:13 作者:佚名
我要評(píng)論

在ie下模擬css3中的box-shadow(陰影)可以使用ie的Shadow(陰影)濾鏡,該濾鏡必須配合background屬性一起使用,否則該濾鏡失效,感興趣的朋友可以參考下哈
在ie下模擬css3中的box-shadow(陰影)可以使用ie的Shadow(陰影)濾鏡
基本語(yǔ)法:filter: progid:DXImageTransform.Microsoft.Shadow(color=’顏色值’, Direction=陰影角度(數(shù)值), Strength=陰影半徑(數(shù)值));
注意:該濾鏡必須配合background屬性一起使用,否則該濾鏡失效。
.box-shadow{
filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=135, Strength=5);/*for ie6,7,8*/
background-color: #eee;
-moz-box-shadow:2px 2px 5px #969696;/*firefox*/
-webkit-box-shadow:2px 2px 5px #969696;/*webkit*/
box-shadow:2px 2px 5px #969696;/*opera或ie9*/
}
讓IE實(shí)現(xiàn)CSS3中的border-radius(圓角)
.box-radius {
border-radius: 15px;
behavior: url(border-radius.htc);
}
大家知道IE 6,7,8不支持CSS3中新加屬性,老外寫了一個(gè)htc,可以讓IE 6,7,8模擬部分的CSS3屬性,包括:border-radius(圓角),box-shadow(陰影),text-shadow(文本陰影):
注意:htc文件是要放在服務(wù)器上,放在本地測(cè)試是不行的!
.box {
-moz-border-radius: 15px; /* Firefox */
-webkit-border-radius: 15px; /* Safari and Chrome */
border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */
-moz-box-shadow: 10px 10px 20px #000; /* Firefox */
-webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */
behavior: url(ie-css3.htc); /* 可以讓IE 6,7,8模擬部分的CSS3屬性 */
}
完整代碼如下:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>讓IE支持css3</title>
<style>
.box-shadow{
width:200px; height:100px;
margin-bottom:20px;
filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=135, Strength=5);/*for ie6,7,8*/
background-color: #eee;
-moz-box-shadow:2px 2px 5px #969696;/*firefox*/
-webkit-box-shadow:2px 2px 5px #969696;/*webkit*/
box-shadow:2px 2px 5px #969696;/*opera或ie9*/
}
.box-radius {
width:200px; height:100px;margin-bottom:20px;
background-color: #eee;
border-radius: 15px;
behavior: url(http://jt.875.cn/css3/border-radius.htc);
}
.box {
width:200px; height:100px;background-color: #eee;margin-bottom:20px;
-moz-border-radius: 15px; /* Firefox */
-webkit-border-radius: 15px; /* Safari and Chrome */
border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */
-moz-box-shadow: 10px 10px 20px #000; /* Firefox */
-webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */
behavior: url(http://jt.875.cn/css3/ie-css3.htc); /* 可以讓IE 6,7,8模擬部分的CSS3屬性 */
}
</style>
</head>
<body>
<div class="box-shadow"></div>
<div class="box-radius"></div>
<div class="box"></div>
</body>
</html>
基本語(yǔ)法:filter: progid:DXImageTransform.Microsoft.Shadow(color=’顏色值’, Direction=陰影角度(數(shù)值), Strength=陰影半徑(數(shù)值));
注意:該濾鏡必須配合background屬性一起使用,否則該濾鏡失效。
復(fù)制代碼
代碼如下:.box-shadow{
filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=135, Strength=5);/*for ie6,7,8*/
background-color: #eee;
-moz-box-shadow:2px 2px 5px #969696;/*firefox*/
-webkit-box-shadow:2px 2px 5px #969696;/*webkit*/
box-shadow:2px 2px 5px #969696;/*opera或ie9*/
}
讓IE實(shí)現(xiàn)CSS3中的border-radius(圓角)
復(fù)制代碼
代碼如下:.box-radius {
border-radius: 15px;
behavior: url(border-radius.htc);
}
大家知道IE 6,7,8不支持CSS3中新加屬性,老外寫了一個(gè)htc,可以讓IE 6,7,8模擬部分的CSS3屬性,包括:border-radius(圓角),box-shadow(陰影),text-shadow(文本陰影):
注意:htc文件是要放在服務(wù)器上,放在本地測(cè)試是不行的!
復(fù)制代碼
代碼如下:.box {
-moz-border-radius: 15px; /* Firefox */
-webkit-border-radius: 15px; /* Safari and Chrome */
border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */
-moz-box-shadow: 10px 10px 20px #000; /* Firefox */
-webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */
behavior: url(ie-css3.htc); /* 可以讓IE 6,7,8模擬部分的CSS3屬性 */
}
完整代碼如下:
復(fù)制代碼
代碼如下:<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>讓IE支持css3</title>
<style>
.box-shadow{
width:200px; height:100px;
margin-bottom:20px;
filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=135, Strength=5);/*for ie6,7,8*/
background-color: #eee;
-moz-box-shadow:2px 2px 5px #969696;/*firefox*/
-webkit-box-shadow:2px 2px 5px #969696;/*webkit*/
box-shadow:2px 2px 5px #969696;/*opera或ie9*/
}
.box-radius {
width:200px; height:100px;margin-bottom:20px;
background-color: #eee;
border-radius: 15px;
behavior: url(http://jt.875.cn/css3/border-radius.htc);
}
.box {
width:200px; height:100px;background-color: #eee;margin-bottom:20px;
-moz-border-radius: 15px; /* Firefox */
-webkit-border-radius: 15px; /* Safari and Chrome */
border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */
-moz-box-shadow: 10px 10px 20px #000; /* Firefox */
-webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */
behavior: url(http://jt.875.cn/css3/ie-css3.htc); /* 可以讓IE 6,7,8模擬部分的CSS3屬性 */
}
</style>
</head>
<body>
<div class="box-shadow"></div>
<div class="box-radius"></div>
<div class="box"></div>
</body>
</html>
相關(guān)文章
- 這篇文章主要介紹了淺談原生頁(yè)面兼容IE9問(wèn)題的解決方案,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起2020-12-16
新版chrome瀏覽器設(shè)置允許跨域的實(shí)現(xiàn)
這篇文章主要介紹了新版chrome瀏覽器設(shè)置允許跨域的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起2020-11-30css hack之\9和\0就可能對(duì)hack IE11\IE9\IE8無(wú)效
每次設(shè)計(jì)一張網(wǎng)頁(yè)或一個(gè)表單,都被各種瀏覽器的兼容問(wèn)題傷透腦筋,尤其是IE家族。在做兼容性設(shè)計(jì)時(shí),我們往往會(huì)使用各種瀏覽器能識(shí)別的獨(dú)特語(yǔ)法進(jìn)行hack,從而達(dá)到各種瀏覽2020-03-20css區(qū)分ie8/ie9/ie10/ie11 chrome firefox的代碼
這篇文章主要介紹了css區(qū)分ie8/ie9/ie10/ie11 chrome firefox的代碼,需要的朋友可以參考下2020-03-20- 這篇文章主要介紹了解決CSS瀏覽器兼容性問(wèn)題的4種方案,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)2020-02-28
- 這篇文章主要介紹了常見的瀏覽器兼容性問(wèn)題(小結(jié)),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)2020-02-20
- 這篇文章主要介紹了border-radius IE8兼容處理的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)2020-02-12
淺談?dòng)龅降膸讉€(gè)瀏覽器兼容性問(wèn)題
這篇文章主要介紹了淺談?dòng)龅降膸讉€(gè)瀏覽器兼容性問(wèn)題,詳細(xì)的介紹了幾種我遇到的問(wèn)題和解決方式,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-09-26- 這篇文章主要介紹了base64圖片在各種瀏覽器的兼容性處理的相關(guān)資料,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-09-14
對(duì)常見的css屬性進(jìn)行瀏覽器兼容性總結(jié)(推薦)
這篇文章主要介紹了對(duì)常見的css屬性進(jìn)行瀏覽器兼容性總結(jié)(推薦)的相關(guān)資料,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-07-20