【发布时间】:2012-11-10 01:15:34
【问题描述】:
我正在尝试做这样的事情:
.box {
background-image: url(../img/box.png);
background-position: 0 0;
background-repeat: no-repeat;
display: block;
height: 64px;
margin: 90px auto;
overflow: hidden;
width: 831px;
}
.shadow_1 {
background-image: url(../img/shadow_1.png);
background-position: 0 100%;
background-repeat: no-repeat;
padding-bottom: 31px;
}
在 HTML 中:
<div class="box shadow_1"></div>
我想将两个类与两个不同的图像组合在一起,但让第二个类中的图像覆盖第一个。有没有可能,或者我必须使用两个divs?
【问题讨论】:
-
根据您需要支持的 IE 版本,您可以使用
:before和:after伪元素为单个元素添加额外的背景(在 IE7 上不确定支持,但在 IE8+ 中有效)
标签: css image class background background-image