带一个削角的CSS特殊形状[重复]

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

[我尝试制作一个剃了一个角的按钮,我在网上搜索,但是找不到创建它的方法。

enter image description here

我尝试的是以下CSS代码:

   #button {
  border-bottom: 100px solid red;
  border-left: 25px solid transparent;
  height: 0;
  width: 100px;
}

但是如您所见,它确实是..:

enter image description here

任何帮助都会很棒

css shapes
1个回答
4
投票

您是否考虑过使用剪切路径?You can try this

.path {
  clip-path: polygon(28% 0, 100% 0, 100% 100%, 0 100%, 0 29%);
  width: 100px;
  height: 60px;
  background-color: tomato;
}
<div class="path"></div>
© www.soinside.com 2019 - 2024. All rights reserved.