【发布时间】:2012-11-05 19:24:58
【问题描述】:
我需要让按钮在 :active 状态下看起来是平的。
比如说,我有:
button {
background:linear-gradient(#fc9, #ed8) /* some light orange gradient */
}
button:hover {
background:linear-gradient(#ed8, #da7) /* some darker orange gradient on hover */
}
button:active {
background:orange; /* And here I need just plane flat orange color */
}
<button>Click Me!</button>
但不是那样,而是从以前的状态获得渐变。
是否有任何背景 CSS 属性可以关闭该渐变?
例如blackground:liner-gradient-OFF; or background:no-inherit;
【问题讨论】:
-
您确定
background: orange还没有这样做吗?它应该,因为它隐式设置background-image: none应该覆盖你的渐变。 -
哇!谢谢你们。看来问题已经解决了!背景图像:无;关闭任何以前的渐变。至少现在点击一下,我就有了一个扁平的橙色。 @BoltClock我不知道为什么它应该覆盖渐变,但在我的情况下它没有。不是第一次注意到这个问题