今天推荐一款好看的微信小程序按钮效果,可定制多种颜色, 有动画效果。
显示效果如下:
动态效果预览:
红色按钮代码如下:
/** button **/
.button1 {
position: relative;
display: inline-block;
min-width: 140rpx;
padding: 10px 40rpx;
margin: 0px 40rpx;
z-index: 2;
background-color: #990000;
background-image: -webkit-gradient(linear,
left top,
left bottom,
color-stop(0, rgb(242, 112, 112)),
color-stop(0.49, rgb(238, 84, 84)),
color-stop(0.5, rgb(240, 54, 54)),
color-stop(1, rgb(219, 26, 26)));
color: #fff;
font-weight: bold;
font-size: 20px;
text-decoration: none;
text-align: center;
line-height: 1;
border: 1px solid;
border-color: #a32f2f #822626 #661e1e #822626;
border-radius: 80px;
animation: btna 2s infinite;
transform: scale(0.95);
box-shadow: inset 0px -4px 5px rgba(255, 255, 255, 0.2),
inset 0px 1px 5px rgba(255, 255, 255, 0.2),
0px 2px 0px #661e1e,
0px 4px 0px #661e1e,
0px 6px 0px #661e1e,
0px 8px 5px rgba(0, 0, 0, 0.5);
}
.b1hover {
top: 4px;
box-shadow: inset 0px 4px 5px rgba(255, 255, 255, 0.4),
inset 0px -1px 5px rgba(255, 255, 255, 0.2),
0px 2px 0px #661e1e,
0px 4px 5px rgba(0, 0, 0, 0.5);
}
@keyframes btna {
0% {
transform: scale(0.95)
}
50% {
transform: scale(1.1)
}
100% {
transform: scale(0.95)
}
}
.button1:nth-child(2) {
animation-delay: 1s;
}