微信小程式實用工具——漸變色按鈕(一)
文章目錄
- 微信小程式實用工具——漸變色按鈕(一)
-
- 前言
- 按鈕一
- 按鈕二
- 按鈕三
- 按鈕四
- 按鈕五
- 按鈕六
- 按鈕七
- 按鈕八
前言
平時我們在開發中的按鈕色調過于單調
于是我在網上找了幾款好看的漸變色按鈕分享一下
下面是動圖的效果展示
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiIXZ05WZj91YpB3IyVGduV2YfNWawNiZpdmL3gDZ5gzYjVTZkhTN2ImNhJ2Y5QDOmZWNlNzMmdDOzczLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.gif)
按鈕一
wxml:
<button class="btn btn-grad1">
</button>
wxss:
.btn-grad1 {
background-image: linear-gradient(to right, #314755 0%, #26a0da 51%, #314755 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad1:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕二
wxml:
<button class="btn btn-grad2">
</button>
wxss:
.btn-grad2 {
background-image: linear-gradient(to right, #ff6e7f 0%, #bfe9ff 51%, #ff6e7f 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad2:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕三
wxml:
<button class="btn btn-grad3">
</button>
wxss:
.btn-grad3 {
background-image: linear-gradient(to right, #003973 0%, #E5E5BE 51%, #003973 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad3:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕四
wxml:
<button class="btn btn-grad4">
</button>
wxss:
.btn-grad4 {
background-image: linear-gradient(to right, #02AAB0 0%, #00CDAC 51%, #02AAB0 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad4:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕五
wxml:
<button class="btn btn-grad5">
</button>
wxss:
.btn-grad5 {
background-image: linear-gradient(to right, #e52d27 0%, #b31217 51%, #e52d27 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad5:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕六
wxml:
<button class="btn btn-grad6">
</button>
wxss:
.btn-grad6 {
background-image: linear-gradient(to right, #DA22FF 0%, #9733EE 51%, #DA22FF 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad6:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕七
wxml:
<button class="btn btn-grad7">
</button>
wxss:
.btn-grad7 {
background-image: linear-gradient(to right, #603813 0%, #b29f94 51%, #603813 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad7:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}
按鈕八
wxml:
<button class="btn btn-grad8">
</button>
wxss:
.btn-grad8 {
background-image: linear-gradient(to right, #77A1D3 0%, #79CBCA 51%, #77A1D3 100%);
margin: 10px;
padding: 15px 45px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
background-size: 200% auto;
color: white;
box-shadow: 0 0 20px #eee;
border-radius: 10px;
display: block;
}
.btn-grad8:hover {
background-position: right center; /* change the direction of the change here */
color: #fff;
text-decoration: none;
}