2017-08-06 243 views
0

我有背景色透明表示作为白色背景色透明显示为白色

这里的问题是一个示范页面: http://www.kurzweilai.net/ray-kurzweil-reveals-plans-for-linguistically-fluent-google-software?utm_source=KurzweilAI+Weekly+Newsletter&utm_campaign=0ad261ad5e-UA-946742-1&utm_medium=email&utm_term=0_147a5a48c1-0ad261ad5e-281975877

中间一列是DIV“包装”

其中有风格:background: url('../images/layout/bg_wrapper.gif') 0 0 repeat-y;

如果我去控制台和类型:

x=document.getElementById('wrapper'); 
window.getComputedStyle(x, null).getPropertyValue('background-color'); 

我得到:

"rgba(0, 0, 0, 0)" 

然而就说明它的背景为白色,而不是车身颜色(黄绿色)。

这是为什么?

Thx!

回答

1

你有三层:body,#wrapper和#wrapper-1。 #wrapper的背景是一个重复的bg_wrapper.gif,并且#wrapper-1一个是重复的bg_wrapper_1.gif,所以最后你会看到gif的颜色。如果你想看到身体背景,你需要删除gif。

0

这就是问题所在:

#wrapper { 
background: url(../images/layout/bg_wrapper.gif) 0 0 

删除background: url(../images/layout/bg_wrapper.gif) 0 0和背景替换为:透明(你没有,你删除后,将是透明的。)

你可以也只是使用!重要的选择器来覆盖。

#wrapper { 
    background: transparent !important; 
}