【问题标题】:CSS: IE: Version of style "background-color:rgba(...)"CSS:IE:样式“背景颜色:rgba(...)”的版本
【发布时间】:2023-03-06 11:32:01
【问题描述】:

我需要有一个带有背景图像的 div,并且在该图像之上应该是一个 0.7 不透明度的黑色层。

为此,我正在使用:

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 中做些什么来在背景图像上创建一个暗淡不透明的黑色层吗?一些“过滤”风格?

【问题讨论】:

    标签: css internet-explorer background opacity


    【解决方案1】:

    没有。您拥有的唯一选项是 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]-->
    

    也看到这个: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;    
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-03
        • 2016-06-29
        • 1970-01-01
        相关资源
        最近更新 更多