背景色透明显示为白色
问题描述:
我有背景色透明表示作为白色背景色透明显示为白色
中间一列是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!
答
你有三层:body,#wrapper和#wrapper-1。 #wrapper的背景是一个重复的bg_wrapper.gif,并且#wrapper-1一个是重复的bg_wrapper_1.gif,所以最后你会看到gif的颜色。如果你想看到身体背景,你需要删除gif。
答
这就是问题所在:
#wrapper {
background: url(../images/layout/bg_wrapper.gif) 0 0
删除background: url(../images/layout/bg_wrapper.gif) 0 0
和背景替换为:透明(你没有,你删除后,将是透明的。)
你可以也只是使用!重要的选择器来覆盖。
#wrapper {
background: transparent !important;
}