我正在尝试为具有 2 列文本的 div 设置阴影。我有基本结构:
<div class="box>
<div id="container" class="pseudo-box">
<p>This is a box</p>
</div>
</div>
并且下面的css似乎应该可以工作,但是每当我取消注释背景图像时,无论是在框还是伪框中,我想用来创建阴影的前后框都会出现在顶部的伪框,尽管我的 z 索引。我怎样才能解决这个问题?
编辑:为简单起见,没有列,还有 JS Fiddle
.box {
position: absolute;
top: 130px;
left: 0;
right: 0;
min-width: 850px;
bottom: 54px;
overflow: hidden;
/* background: white url(/u/me/workspace/test2/webdesign/ribbon-horiz.png) top left no- repeat;
*/ border-bottom: solid thin #aaaaaa;
font-size: 16px;
line-height: 150%;
text-align: left;
z-index: 10;
background: white;
}
.pseudo-box{
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cbcbcb), color-stop(100%,#bfbfbf));
background: url(/u/me/workspace/test2/webdesign/ribbon-horiz.png) top left no-repeat;
border: 1px solid #888888;
border-radius: 6px;
padding: 10px;
position: relative;
}
.pseudo-box:before,
.pseudo-box:after {
content:"";
position:absolute;
z-index: -1;
bottom: 10px;
left:10px;
width:50%;
height:50%;
max-width:300px;
-webkit-box-shadow:0 10px 5px rgba(0, 0, 0, 0.7);
-moz-box-shadow:0 10px 5px rgba(0, 0, 0, 0.7);
box-shadow:0 10px 5px rgba(0, 0, 0, 0.7);
-webkit-transform:rotate(-3deg);
-moz-transform:rotate(-3deg);
-o-transform:rotate(-3deg);
transform:rotate(-3deg);
background-image: none;
}
.pseudo-box:after {
right:10px;
left:auto;
-webkit-transform:rotate(3deg);
-moz-transform:rotate(3deg);
-o-transform:rotate(3deg);
transform:rotate(3deg);
}
#content {
position: absolute;
left: 20px;
right: 20px;
top: 40px;
bottom: 20px;
min-width: 650px;
padding: 0 10px 0 0;
overflow: auto;
border-top: thin solid #aaa;
border-bottom: thin solid #aaa;
border-left: thin solid #aaa;
border-right: thin solid #aaa;
border-radius: 4px;
/* box-shadow: 4px 4px 9px 2px #aaa;
*/
}