这就是我想要的效果CSS effect
我已经在我的 wordpress 主题的页面中尝试过这个但没有用。情况如下: 当我取消选中 z-index 时,带有阴影的旋转框条会出现在该区域的正面,但是当我将其转回阴影时,阴影就会消失,旋转条也会消失。此效果背后的场景是将旋转条隐藏在背景区域后面,同时仅显示阴影。请问有什么解决办法吗? 这是代码:
HTML
<div class="box effect1">
<h3>Effect 1</h3>
CSS
.box h3
{
text-align:center;
position:relative;
top:80px;
}
.box
{
width:70%;
height:200px;
background:#FFF;
margin:40px auto;
}
.effect2
{
position: relative;
}
.effect2:before, .effect2:after
{
z-index: -1;
position: absolute;
content: "";
bottom: 15px;
left: 10px;
width: 50%;
top: 80%;
max-width:300px;
background: #777;
box-shadow: 0 15px 10px #777;
transform: rotate(-3deg);
}
.effect2:after
{
transform: rotate(3deg);
right: 10px;
left: auto;
}
最佳答案
你的 CSS 引用了“effect2”,但你的 DIV 有一个类“effect1”
当我将 DIV 更改为“effect2”时,我看到了您想要的样式。
关于html - Wordpress Z-index 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40951612/