0
我使用Animating a CSS gradient background on the hover event以下的代碼,這太棒了。但是,我希望漸變從左到右。旋轉漸變
.gradient {
background: -webkit-linear-gradient(lightgray,white);
background: -moz-linear-gradient(lightgray,white);
background: -o-linear-gradient(lightgray,white);
background: linear-gradient(lightgray,white);
-webkit-transition: background 1s ease-out;
-moz-transition: background 1s ease-out;
-o-transition: background 1s ease-out;
transition: background 1s ease-out;
-moz-background-size: 1px 200px;
-o-background-size: 1px 200px;
-webkit-background-size: 1px 200px;
background-size: 1px 200px;
cursor: pointer;
}
.gradient:Hover {
background-position: 100px;
}
我嘗試添加左和與背景圖像替換背景這裏討論:http://www.webdirections.org/blog/css3-linear-gradients/
.gradient {
background: -webkit-linear-gradient(left, lightgray,white);
background: -moz-linear-gradient(left, lightgray,white);
background: -o-linear-gradient(left, lightgray,white);
background: linear-gradient(left, lightgray,white);
-webkit-transition: background 1s ease-out;
-moz-transition: background 1s ease-out;
-o-transition: background 1s ease-out;
transition: background 1s ease-out;
-moz-background-size: 1px 200px;
-o-background-size: 1px 200px;
-webkit-background-size: 1px 200px;
background-size: 1px 200px;
cursor: pointer;
}
.gradient:Hover {
background-position: 100px;
}
仍然沒有骰子。
:捂臉:謝謝! –
不錯,它幫助你。我已經添加了更好的解決方案。 – vals