使用创建的阴影:before
并:after
位于 parent 之下div
。我该如何解决?父母的影子div
工作正常。
CSS:
article {
display: block;
position: relative;
width: 90%;
background: #ccc;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 1.5em;
color: rgba(0,0,0, .8);
text-shadow: 0 1px 0 #fff;
line-height: 1.5;
text-align: center;
display: block;
margin: 20em auto;
}
article:before, article:after {
z-index: -1;
position: absolute;
content: "";
bottom: 15px;
left: 10px;
width: 50%;
top: 80%;
max-width:300px;
background: rgba(0, 0, 0, 0.7);
-webkit-box-shadow: 0 15px 10px rgba(0,0,0, 0.7);
-moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
}
article:after {
-webkit-transform: rotate(3deg);
-moz-transform: rotate(3deg);
-o-transform: rotate(3deg);
right: 10px;
left: auto;
}
HTML:
<body>
<div>
<table>
<tr>
<td>
<div>this div has also a nice shadow effect (works), but created with another div by z-index:-1;
<article>
<p>this will have a nice shadow effect(doesnt work)</p>
</article>
</div>
...