Jignesh Panchal
Jignesh Panchal

Reputation: 1376

How to set shape in image with clip-path

Is it possible to set image in same shape with clip-path css.

Original Image

enter image description here

Expected image with css

enter image description here

Upvotes: 1

Views: 148

Answers (1)

Temani Afif
Temani Afif

Reputation: 272598

You don't really need clip-path or mask. A skew transformation with border-radius can do it:

.box {
  margin:50px;
  border-radius:80px 0;
  height:300px;
  background:red;
  position:relative;
  background:url(https://i.sstatic.net/rYeuk.jpg) center/cover;
  transform:skewY(-7deg);
  transform-origin:right;
  overflow:hidden;
}
.box::before {
  content:"";
  position:absolute;
  background:inherit;
  top:-20%;
  left:0;
  right:0;
  bottom:-20%;
  transform:skewY(7deg);
}

body {
  background:red;
}
<div class="box">

</div>

Upvotes: 1

Related Questions