CSS 实现圆角按钮:贝塞尔曲线技巧
以下是一个使用 CSS 画圆角按钮的例子:
<button class='rounded'>按钮</button>
.rounded {
display: inline-block;
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 25px;
transition: all 0.3s ease;
cursor: pointer;
}
.rounded:hover {
background-color: #3e8e41;
}
.rounded:focus {
outline: none;
}
在上面的例子中,我们使用了 'border-radius' 属性来实现按钮的圆角。如果你想使用贝塞尔曲线来实现圆角,可以这样写:
.rounded {
border-radius: 50% / 10px 50px 30px 20px;
}
在上面的代码中,我们使用了 'border-radius' 的扩展语法,其中 '50%' 表示水平和垂直方向的圆角半径相等,后面的四个值表示左上角、右上角、右下角和左下角的圆角半径分别为 10px、50px、30px 和 20px。这样就可以使用贝塞尔曲线来实现不规则的圆角效果了。
原文地址: https://www.cveoy.top/t/topic/lJ7v 著作权归作者所有。请勿转载和采集!