How to create a curve as shown below for the div

我是研究僧i 提交于 2019-11-27 09:50:05

You can make the element to overflow by adding negative values to left/right. then add some padding to avoid content overflow like this :

.container {
  width: 200px;
  border: 1px solid blue;
  height: 200px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

.count-select {
  box-shadow: 0 -5px 10px -5px rgba(0, 0, 0, .8);
  border-top: 2px solid #E75532;
  height: 50px;
  background: #fff;
  position: absolute;
  bottom: 0;
  left: -30px;
  right: -30px;
  padding: 12px 30px;
  border-radius: 50%;
  text-align:center;
}
<div class="container">
  <div class="count-select ">
    select items
  </div>
</div>

If you divide it into two divs instead of one, you can control to how far the border radius should go. See example below.

body {
  background: lightgoldenrodyellow;
}

.top {
  background: white;
  border-top: 2px solid red;
  border-top-left-radius: 50%;
  border-top-right-radius: 50%;
  height: 100px;
  width: 400px;
  text-align: center;
  box-shadow: 0px -3px 10px rgba(0,0,0,0.3);
}

.middle {
  background: white;
  width: 400px;
  height: 100px;
  text-align: center;
  margin: 0;
}
<div class="container">
<div class="top">
  <p>Select items and swipe up</p>
</div>
<div class="middle">
0 items selected
</div>
</div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!