gpt4 book ai didi

html - 左右边缘的插图框阴影褪色/透明

转载 作者:太空宇宙 更新时间:2023-11-04 07:17:48 29 4
gpt4 key购买 nike

我正在尝试添加一个在 div 的左右边缘具有透明度/淡出的嵌入框阴影。我设法添加了一个普通的嵌入框阴影,但我不知道如何为边缘添加透明度。我该怎么做?

这是我正在努力实现的一个例子。 enter image description here

  .container {
height: 300px;
width: 300px;
box-shadow: rgb(178, 169, 169) 0px 8px 8px -8px inset, rgb(178, 169, 169) 0px -8px 8px -8px inset;
<div class="container">
</div>

最佳答案

我设法使用 radial-gradient 做到了。检查这个 fiddle

*{
box-sizing: border-box;
}

body{
margin: 0;
}
.banner{
width: 100%;
padding: 30px;
background: #eee;
position: relative;
}

.banner::before{
content: "";
background: radial-gradient(ellipse at center, rgba(0,0,0,0.25) 0%,rgba(0,0,0,0) 75%);
height: 100%;
width: 100%;
position: absolute;
left: 0;
top: 15px;
z-index: -1;
}
<div>
<div class="banner"></div>
</div>

关于html - 左右边缘的插图框阴影褪色/透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50586435/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com