如果我这样做:
然后,背景图片不再显示。
为什么?
.floatingBox div div {
text-align: center;
position: relative;
background-image: url('../images/car.png');
background-repeat: no-repeat;
background-position: center;
}
<div class='floatingBox'>
<div class='effect2'>
<a href=/Devis/moto><div class='motorbike'></div></a>
</div>
</div>
如果我这样做:
那么背景图片就会正常显示。
但是如果我这样做:
.floatingBox div div {
text-align: center;
position: relative;
background-repeat: no-repeat;
background-position: center;
}
.motorbike {
background-image: url('../images/moto.png');
}
然后,背景图片不再显示。
为什么?
.motorbike
背景是否被顶部的背景覆盖了,因为它具有更详细的路径?尝试指定底部的背景,或将顶部的背景属性替换为.motorbike
。 - Toon Casteele