简体   繁体   English

CSS:IE:样式“ background-color:rgba(…)”的版本

[英]CSS: IE: Version of style “background-color:rgba(…)”

I have a requirement to have a div with a background image, and overtop that image should be a 0.7-opacity black layer. 我需要有一个带有背景图像的div,并且该图像的上方应该是0.7透明度的黑色层。

For this, I'm using: 为此,我正在使用:

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

This works perfectly in everything but IE. 除IE之外,此功能在所有其他情况下均可完美运行。 In IE 6, 7, and 8, the background-color:rgba(0, 0, 0, 0.7); 在IE 6、7和8中, background-color:rgba(0, 0, 0, 0.7); isn't rendered. 没有呈现。

Is there anything I can do in CSS without changing the markup to create a dimmed-opacity black layer over the background image? 我可以在CSS中做任何事情而无需更改标记以在背景图像上创建不透明的黑色图层吗? Some "filter" style? 一些“过滤器”样式?

No. The only options you have are ms-filters or a slightly different one. 否。您拥有的唯一选项是ms-filters或稍有不同的选项。

<!--[if IE]>

   <style type="text/css">

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

    </style>

<![endif]-->

see this one too: http://www.hedgerwow.com/360/dhtml/rgba/demo.html 也可以看到这一点: http : //www.hedgerwow.com/360/dhtml/rgba/demo.html

I had a similar issue and to over come it I used to classes on my modal div one for the background opacity etc.. the other just to display the spinner. 我有一个类似的问题,后来我在模态div上进行分类,一个用于背景不透明度等。另一个仅用于显示微调器。 This route seems to work for all current browsers I've tested on. 这条路线似乎适用于我测试过的所有当前浏览器。

.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;    
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM