如何使“剪辑路径”中的径向角看起来干净?

问题描述 投票:0回答:1

我正在尝试制作一个具有不寻常形状的登录表单,但我正在使用border-radius<div>上与clip-path进行斗争。

这是我在<div>上使用的CSS:

background: red;
height: 80%;
-webkit-clip-path: polygon(100% 0, 0 0, 100% 100%);
clip-path: polygon(100% 0, 0 0, 100% 100%);
border-radius: 5em;

它目前看起来像这样:

Picture showcasing the problem.

如您所见,左上角和右下角的border-radius被切断。是否有解决方法使这个干净?

而不是被切断的角落,我希望它们如下图所示。

Picture showcasing the desired result.

html css
1个回答
0
投票

试试这个:

.block {
  background: red;
  height: 300px;
  width: 200px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0);
  border-radius: 10px;
}
 <div class="block"></div>
© www.soinside.com 2019 - 2024. All rights reserved.