【发布时间】:2013-05-14 17:28:30
【问题描述】:
如何将按钮的背景设为两种纯色?请参阅下面的示例。
总体目标是让按钮在悬停时从两种蓝色过渡到两种灰色。
颜色:
- 蓝色:
#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/
非常感谢您的帮助
【问题讨论】:
-
@sylwia 无聊。我在很多事情上都使用渐变。我认为两种相似的纯色可能会带来更清晰的感觉。
标签: css button background-color