2010-09-09 55 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;  
}