如何创建css凹/凸形状

Han*_*Che 6 sass css3 css-shapes

我想创建两个具有下面描述的背景白色形状的div.正如你所看到的,它基本上是一个矩形和椭圆形切割.它应该能够产生一个盒子阴影.

有没有办法用css实现这个目的?

凹形

Vit*_*des 8

我已经使用了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;
}
Run Code Online (Sandbox Code Playgroud)
<div class="out">
  <div class="in">

  </div>
</div>

<div class="out bottom">
  <div class="in">

  </div>
</div>
Run Code Online (Sandbox Code Playgroud)