作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我遇到的问题是伪元素 :before 的阴影在它的元素前面。
https://jsfiddle.net/36aqf40y/3/
<div class="rectangle">
<p>Lorem Ipsum</p>
<a href="#" style="color:#FFFFFF">Lorem Ipsum</a>
</div>
<style>
.rectangle {
display: inherit;
position: absolute;
min-width: 200px;
max-width: 400px;
height: 98px;
background-color: #D90030;
z-index: 1;
box-shadow: 3px 3px 5px 0px rgba(0, 0, 0, 0.75);
}
.rectangle:before {
content: " ";
position: absolute;
left: 100%;
border-left: 30px solid #D90030;
border-top: 49px solid transparent;
border-bottom: 49px solid transparent;
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.75));
}
.rectangle * {
margin: 20px 0 10px 20px;
}
.rectangle p {
font-size: 23px;
color: white;
}
</style>
我真的很想在.rectangle
后面有.rectangle:before
的影子。这样的事情可能吗?
最佳答案
使用
filter: drop-shadow(3px 1px 1px rgba(0, 0, 0, 0.75));
代替
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.75));
.rectangle {
display: inherit;
position: absolute;
min-width: 200px;
max-width: 400px;
height: 98px;
background-color: #D90030;
z-index: 1;
box-shadow: 3px 3px 5px 0px rgba(0, 0, 0, 0.75);
}
.rectangle:before {
top:1px;
content: " ";
position: absolute;
left: 100%;
border-left: 30px solid #D90030;
border-top: 49px solid transparent;
border-bottom: 49px solid transparent;
filter: drop-shadow(3px 1px 1px rgba(0, 0, 0, 0.75));
}
.rectangle * {
margin: 20px 0 10px 20px;
}
.rectangle p {
font-size: 23px;
color: white;
}
<div class="rectangle">
<p>Lorem Ipsum</p>
<a href="#" style="color:#FFFFFF">Lorem Ipsum</a>
</div>
关于html - 伪元素的影子可以留在它的元素后面吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52423964/
这是我的jade雕像: section#entry-review-template.template(data-class='entry-review') table thead
我是一名优秀的程序员,十分优秀!