How to obtain a slanted-curve for my div? Like one shown below

Viewed 110

enter image description here

This is a div that stretches the whole mobile screen; I'd want it to have a tilted curve(as shown in image) from top-right to top-left. I tried border-radius but that didn't work as expected. Is there a way to do this using CSS?

1 Answers

Perhaps clip-path property might work for you.....

.container {
  background: #f6eee0;
  clip-path: polygon(0 10%, 100% -2%, 100% 100%, 0 100%);
  height: 80vh;
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container"></div>
  </body>
</html>

Here is the updated snippet including the curve, if you need to increase/decrease the size of the curve just play around with the negative value in the clip-path property until you find the sweet spot and suits you the best...

Related