Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make a div shaped like a quarter of an ellipse in CSS?

So, how do you make a div that's shaped like the bottom-left quarter of an ellipse in CSS3?

CSS3 supports rounded corners, but there is no obvious way to make a div shaped like a quarter of an ellipse.

The height of the div is supposed to be 50px, and the width is supposed to be 25% of the screen.

like image 975
FlatAssembler Avatar asked Nov 03 '25 10:11

FlatAssembler


2 Answers

To start, the shape you're describing might not always be an ellipse. Depending on the screen size, the 25% width might result in a circle.

That said, here's a simple quarter-ellipse with just a few lines of CSS. The important CSS property being the border-bottom-left-radius: 100%.

div {
  height: 50px;
  width: 25%;
  background-color: red;
  border-bottom-left-radius: 100%;
}
<div></div>
like image 97
Brett DeWoody Avatar answered Nov 05 '25 22:11

Brett DeWoody


Maybe simply using border-radius like this :

.box {
  height: 50px;
  width: 25%;
  background: blue;
  border-radius: 0 0 0 100%;
}
<div class="box">
</div>

Here is another fancy way using radial-gradient and the ellipse value:

.box {
  height: 50px;
  width: 25%;
  background-image: radial-gradient(ellipse at top right, red 68%, transparent 70%);
}
<div class="box">
</div>
like image 35
Temani Afif Avatar answered Nov 05 '25 23:11

Temani Afif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!