Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a bottom curve in a div - CSS?

Tags:

html

css

Following is my code in which I am unable to create a bottom curve but increasing the border-top-left-radius/border-top-right-radius is not able to create a bump as shown in fig. Let me know how can I handle this using CSS only.

Code:

.container {
  position: relative;
}
.rect {
  width: 334.5px;
  height: 223px;
  background: #34EFEE;
  text-align: center;
  line-height: 223px;
}
.rect:after {
  content: '';
  position: absolute;
  bottom: 0px;
  width: 334.5px;
  height: 15px;
  background: #FFFFFF;
  left: 0;
  border-top-left-radius: 50%;
  border-top-right-radius: 50%;
}
<div class="container">
  <div class="rect">
    <h3>334.5 X 223</h3>
  </div>
</div>

Expected Output -

Expected Output

PLNKR -- http://plnkr.co/edit/7oTCHyn8PFABri0KHSrH?p=preview

like image 216
Nesh Avatar asked Sep 01 '25 22:09

Nesh


1 Answers

You can use :after pseudo element to create shape and add large box-shadow for blue background.

div {
  width: 300px;
  height: 150px;
  position: relative;
  overflow: hidden;
  text-align: center;
  color: white;
}
div:after {
  content: '';
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  left: 50%;
  height: 100px;
  width: 120%;
  border: 5px solid black;
  transform: translate(-50%, 50%);
  box-shadow: 0px 0px 0px 200px #00A2E8;
  border-radius: 50%;
  z-index: -1;
}
<div>Lorem ipsum</div>
like image 91
Nenad Vracar Avatar answered Sep 03 '25 14:09

Nenad Vracar