Home  >  Article  >  Web Front-end  >  CSS设置div透明度-FF3.5+ 已不支持-moz-opacity_html/css_WEB-ITnose

CSS设置div透明度-FF3.5+ 已不支持-moz-opacity_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:28:321298browse

让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;

 

但 FireFox 3.5+ 已不再支持 -moz-opacity

在https://developer.mozilla.org/En/CSS:-moz-opacity里说得很清楚了:
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中的字不半透明


图层背景半透明,字体颜色也半透明

图层背景半透明,字体颜色不半透明& lt;/div>

 

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn