![](/img/trans.png)
[英]How to apply box shadow on a div when input element inside it is focused
[英]How do I give box shadow to a <div> element or <hr /> element where the shadow fades out from the middle?
像这样的东西就是你要找的。
使用 z-index:-1,我们可以将伪元素定位在其父元素下方,并使用 box-shadow 的第 4 个参数,我们可以增加其范围。 调整数字以获得您想要的结果。
.shadow { position: relative; width: 300px; height: 120px; background: #ccc; } .shadow::after { content: ''; display: block; position: absolute; bottom: 30px; left: 50%; box-shadow: 0 0 60px 60px rgba(0, 0, 0, 0.5); width: 0; height: 0; z-index: -1; }
<div class="shadow"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.