Learn how to feather the edges of blocks using CSS
P粉785522400
2023-08-16 18:38:07
<p>How do I modify my CSS to have a feathered blur effect on the edges of the box? I would like the background of the box to have a frosted glass effect, and instead of sharp edges around it, have a feathered effect that gradually blends into the background, but I don't know how to modify the current CSS. Hope to get your help, thank you. </p>
<p><br /></p>
<pre class="brush:css;toolbar:false;">.wrap {
position: relative;
width: 100%;
height: 100vh;
background-image: url('https://images.unsplash.com/photo-1593642634443-44adaa06623a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1625 &q=80 ');
background-size: cover;
.box {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 200px;
background-color: red;
border-radius: 50%;
background-color: rgba(225, 225, 225, 10%);
backdrop-filter: blur(2px);
}
}</pre>
<pre class="brush:html;toolbar:false;"><div class="wrap">
<div class="box"></div>
</div></pre>
<p><br /></p>
All I understand is to add any code snippet below:
box-shadow: inset 2px 2px 15px #fff; // or box-shadow: inset 2px 2px 15px rgba(255,255,255,.5)