0

I'm trying to make a normal shaped image be transformed into the following shape when uploaded to my website:

enter image description here

Using the following css i managed to get something close to this:

.img {
  position: absolute;
  left: 0px;
  top: -10rem;
  width: 100%;
  height: 100%;
  border-top-right-radius: 10%;
  border-bottom-right-radius: 45%;
  border-bottom-left-radius: 50%;
  border-top-left-radius: 50%;
}

But it doesn't really look circular at the bottom and right side., the shape comes out odd.

I basically want the CSS to transform any shaped image uploaded into the right angle/circle shape attached, but I'm struggling. Any help appreciated.

Anthony
  • 929
  • 7
  • 21

2 Answers2

2

You mean like this??

.box {
  width: 400px;
  height: 400px;
  border: 1px solid blue;
  overflow: hidden;
}

.circle {
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background-color: red;
  position: relative;
  top: -150px;
  left: -150px;
}
<div class="box">
  <div class="circle"> </div>
</div>
GreyRoofPigeon
  • 17,833
  • 4
  • 36
  • 59
2

You can use css clipping masks to cut the image into shape.

clip-path: circle(60% at 30% 30%);

Code result

If you need help creating the mask, use clippy.