2010-09-09 53 views
2

我有一个需要有背景图像的div,并且超过该图像应该是0.7不透明的黑色图层。CSS:IE:风格“background-color:rgba(...)”的版本

对于这一点,我使用:

background-color:rgba(0, 0, 0, 0.7); 
background-image:url(/Images/hash-000000-pattern.gif); 

这完全适用于一切,但IE浏览器。在IE 6,7和8中,background-color:rgba(0, 0, 0, 0.7);未呈现。

有没有什么我可以在CSS中做的,而不改变标记在背景图像上创建一个黯淡不透明的黑色图层?一些“过滤”风格?

回答

4

不可以。唯一的选择是ms滤镜或稍微不同的滤镜。

<!--[if IE]> 

    <style type="text/css"> 

    .color-block { 
     background:transparent; 
     filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000050,endColorstr=#99000050); 
     zoom: 1; 
    } 

    </style> 

<![endif]--> 

看到这一个了:http://www.hedgerwow.com/360/dhtml/rgba/demo.html

2

我也有类似的问题,并克服该我用的类对我的情态DIV一个背景不透明度等。对方只是显示微调。这条路线似乎适用于我测试过的所有当前浏览器。

.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    top: 0; 
    left: 0; 
    height: 100%; 
    width: 100%;  
    background: rgba(255,255,255, .8); 
    background-color: #fff; 
    opacity: 0.8; 
    filter: alpha(opacity=80); 
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; 
} 
.spinner{ 
    z-index: 1010; 
    background-image: url(/_Layouts/Images/GEARS_AN.GIF); 
    background-position: 50% 50%; 
    background-repeat: no-repeat;  
}