【发布时间】:2021-11-19 08:27:19
【问题描述】:
我想创建一个倒置的边框半径,类似于:
但是,由于box-shadow,很难创建它。我尝试了很多解决方案,例如使用box-shadow inset,或者使用clip-path 过滤器drop-shadow,但效果不佳。
我在这一点上:
body {
height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: white;
}
.wrapper {
width: 100%;
//filter: drop-shadow(0 0 2rem #0000005c);
}
.header {
background-color: #efefef;
width: 85%;
aspect-ratio: 16/3;
border-radius: 1.5rem;
border: 1px solid #d0d0d0;
box-shadow: 0 0 2rem #0000005c;
position: relative;
margin: 0 auto;
//clip-path: url(#myClip);
}
.dashed {
width: 100%;
position: absolute;
top: 50%;
border-bottom: 1px dashed black;
}
.dashed:after {
content: '';
position: absolute;
width: 8rem;
height: 4rem;
background: white;
left: -7rem;
top: -2rem;
border-radius: 0 2rem 2rem 0;
box-shadow: 0 0 2rem #0000005c inset;
clip-path: inset(0 0 0 80%);
}
<div class="wrapper">
<div class="header">
<div class="dashed"></div>
</div>
</div>
<!--
<svg width="0" height="0">
<defs>
<clipPath id="myClip">
<circle cx="50" cy="50" r="50" />
<rect width = "10000" height = "10000"
</clipPath>
</defs>
</svg>
-->
我尝试使用带有多个clip-path 的svg 来在css 上引用它。
原图:
【问题讨论】:
-
圆形钻头从白色到灰色的径向渐变背景和直线钻头的线性渐变怎么样?