我想在懸停時使用 HTML 和 CSS 為漸變按鈕設定影片。但什么也沒有發生。請。任何人都可以幫助這種情況
.btn {
padding: 20px 40px;
background-image: var(--gradient-button);
color: var(--secondary-color);
border: none;
border-radius: 30px;
font-size: 1rem;
font-weight: 700;
text-decoration: none;
transition: 0.6s;
cursor: pointer;
}
.btn:hover {
background-position: right;
}
uj5u.com熱心網友回復:
你可以試試這個:
更多按鈕:https : //codepen.io/JavaScriptJunkie/pen/pPROoV
.buttons {
margin: 10%;
text-align: center;
}
.btn-hover {
width: 200px;
font-size: 16px;
font-weight: 600;
color: #fff;
cursor: pointer;
margin: 20px;
height: 55px;
text-align:center;
border: none;
background-size: 300% 100%;
border-radius: 50px;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.btn-hover:hover {
background-position: 100% 0;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.btn-hover.color {
background-image: linear-gradient(to right, #25aae1, #40e495, #30dd8a, #2bb673);
box-shadow: 0 4px 15px 0 rgba(49, 180, 180, 0.75);
}
<button class="btn-hover color">BUTTON</button>
uj5u.com熱心網友回復:
也許通過一些更改,您可以擁有它。這只是一個例子。
對于從右到左,在“背景影像:線性漸變(”中使用到左,并在其中分配顏色。
也許白色文字顏色適合這口井。
.btn{
border: none;
margin: 20px;
padding: 24px;
width: 220px;
font-family: "montserrat",sans-serif;
text-transform: uppercase;
border-radius: 6px;
cursor: pointer;
color: #fff;
background-size: 200%;
transition: 0.6s;
}
.btn1{
background-image: linear-gradient(to left,#FFC312,#EE5A24,#FFC312);
}
.btn:hover{
background-position: right;
}
<button class="btn btn1">BUTTON</button>
uj5u.com熱心網友回復:
你已經在正確的軌道上。我在幾個地方做了一些小的修改。
:root {
--gradient-button: red;
--text-color: white;
}
.btn {
padding: 20px 40px;
background: var(--gradient-button);
color: var(--text-color);
border: none;
border-radius: 30px;
font-size: 1rem;
font-weight: 700;
text-decoration: none;
background-size: 300% 100%;
cursor: pointer;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
background-image: linear-gradient(to right, red, orange, yellow, green);
box-shadow: 0 4px 15px 0 rgba(49, 196, 190, 0.75);
}
.btn:hover {
background-position: 100% 0;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
<button class="btn">btn</button>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/384471.html
上一篇:根據輸入值隱藏嵌套按鈕
