如何让一个按钮的背景颜色呈现两种固定颜色?请参考下面的示例。
总体目标是在鼠标悬停时,按钮从两个蓝色渐变到两个灰色。
颜色:
- 蓝色:
#4098D3
(亮色),#2B8DCF
(深色) - 灰色:
#515758
(亮色),#2B8DCF
(深色)
HTML按钮语法:<button class="submit"></submit>
CSS:
button.submit {
[background CSS from this question] }
button.submit:hover {
[background CSS from this question with alternate colors]
cursor: pointer;
-webkit-transition: background 0.5s linear;
-moz-transition: background 0.5s linear;
-ms-transition: background 0.5s linear;
-o-transition: background 0.5s linear;
transition: background 0.5s linear;
}
请随意使用我为此查询设置的JSFiddle: https://jsfiddle.net/DMc9N/
非常感谢您的帮助。