CSS設定div透明度-FF3.5+ 已不支援-moz-opacity

來源:互聯網
上載者:User

讓div 透明,相容IE FF

transparent_class{filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity:0.5;opacity:0.5;}

filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;

 

 

在裡說得很清楚了:
Note: Firefox 3.5 and later do not support -moz-opacity. By now, you should be using simply opacity.
現在都要改用opacity這個屬性。

於是要設定一下透明度為60%的DIV就應該這樣寫了:
div.transp { /* make the div translucent */
opacity: 0.6; /* Firefox, Safari(WebKit), Opera)
filter: "alpha(opacity=60)"; /* IE 8 */
filter: alpha(opacity=60); /* IE 4-7 */
zoom: 1; /* needed in IE up to version 7, or set width or height to trigger "hasLayout" */
}

opacity這個是屬於CSS3裡面的東西了,屬於CSS3的標準。然而微軟IE8還不支援這一屬性。

網易郵箱目前也是用-moz-opacity,因此當“清空垃圾郵件”時螢幕一片黑。

DIV背景半透明,DIV中的字不半透明

<body bgcolor="#336699">
<div style="filter:alpha(opacity=50);background:#ffffff;width:600;"><span style="color:yellow">圖層背景半透明,字型顏色也半透明</span></div>
<div style="filter:alpha(opacity=50);background:#ffffff;width:600">< span style="position:relative;color:yellow">圖層背景半透明,字型顏色不半透明</span></div>

 

轉:http://www.psdiv.com/11/49.html

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.