看到别人app里的一个按钮,是圆角加倾斜的,如下图所示
自己尝试编写,用clip-path进行剪裁,会发现切割下来边缘是直角,如下图所示
所以该怎么弄,才能都是圆角呢?
下面的代码是边缘直角,希望大佬帮忙改成圆角
<div style="display:flex;">
<div class="up">涨58%</div>
<div class="down">跌58%</div>
</div>
=====css部分====
.up{
clip-path:polygon(0% 0%,100% 0%,90% 100%,0% 100%);
box-sizing:border-box;width:250px;height:40px;line-height:40px;padding-left:10px;border-top-left-radius:99px;border-bottom-left-radius:99px;background:#38f;
}
.down{
clip-path:polygon(10% 0%,100% 0%,100% 100%,0% 100%);
text-align:right;padding-right:10px;box-sizing:border-box;width:250px;height:40px;line-height:40px;border-top-right-radius:99px;border-bottom-right-radius:99px;background:#ac3;
}
CSS部分:
html部分:
纯色的话可以这么搞,但是如果涉及到按钮渐变的话就会有问题
新增水平渐变
这个是90度水平渐变的实现,效果如下:
