如何创建 css concave/convex 形状
how to create css concave/convex shapes
我想创建两个背景为白色的 div,如下所示。如您所见,它基本上是一个矩形和一个被切出的椭圆形。它应该能够产生一个盒子阴影。
有没有办法只用 css 来实现这个目标?
我使用了 2 个 div 和 box-shadow
我添加了 border
以便理解
body {
background:url(https://placeimg.com/640/480/any);
}
.out {
width: 455px;
height: 275px;
border: 1px solid red;
position: relative;
overflow: hidden;
margin: 20px;
}
.in {
width: 550px;
height: 550px;
border: 1px solid green;
position: absolute;
left: 200px;
border-radius: 50%;
box-shadow: 0 0 0 500px white; /* this is the white background */
}
.bottom .in {
bottom: 0;
left: 200px;
}
<div class="out">
<div class="in">
</div>
</div>
<div class="out bottom">
<div class="in">
</div>
</div>
我想创建两个背景为白色的 div,如下所示。如您所见,它基本上是一个矩形和一个被切出的椭圆形。它应该能够产生一个盒子阴影。
有没有办法只用 css 来实现这个目标?
我使用了 2 个 div 和 box-shadow
我添加了 border
以便理解
body {
background:url(https://placeimg.com/640/480/any);
}
.out {
width: 455px;
height: 275px;
border: 1px solid red;
position: relative;
overflow: hidden;
margin: 20px;
}
.in {
width: 550px;
height: 550px;
border: 1px solid green;
position: absolute;
left: 200px;
border-radius: 50%;
box-shadow: 0 0 0 500px white; /* this is the white background */
}
.bottom .in {
bottom: 0;
left: 200px;
}
<div class="out">
<div class="in">
</div>
</div>
<div class="out bottom">
<div class="in">
</div>
</div>