css实现倾斜按钮(radial-gradient)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>倾斜按钮</title>
<style>
.box {
width: 500px;
margin: 50px auto;
}
.button {
width: 300px;
height: 88px;
background: #0692ff;
font-size: 24px;
color: #fff;
line-height: 88px;
text-align: center;
margin: 0 auto;
border: none;
border-radius: 20px 0 20px 0;
position: relative;
transform: skew(-20deg);
}
.button::after {
content: "";
position: absolute;
background: radial-gradient(
circle at 100% 100%,
transparent 20px,
#0692ff 21px
);
width: 20px;
height: 20px;
top: 0;
right: -19px;
}
.button::before {
content: "";
position: absolute;
background: radial-gradient(
circle at 0 0,
transparent 20px,
#0692ff 21px
);
width: 20px;
height: 20px;
bottom: 0;
left: -19px;
}
.button span {
display: block;
transform: skew(20deg);
}
</style>
</head>
<body>
<div class="box">
<button class="button">
<span>倾斜按钮</span>
</button>
</div>
</body>
</html>