我一直在绞尽脑汁寻找 CSS 渐变的解决方案。我打算将“添加到购物车”按钮变为橙色;它显示了黑色,它被设置为所有按钮的“默认”。
笔记:
它在 Chrome 中显示橙色的“添加到购物车”。Firefox 的工作方式有所不同。
-
代码:
.button,
#button,
#submit,
.edit{
margin: 1em 0 1.5em 0;
display: inline-block;
cursor: pointer;
font-size: 1em;
font-weight: normal;
text-align: center;
color: #fff;
padding: 8px 25px;
background: -moz-linear-gradient(
top,
#212121 0%,
#0a0a0a);
background: -webkit-gradient(
linear, left top, left bottom,
from(#212121),
to(#050505));
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #000;
-moz-box-shadow:
0px 1px 2px rgba(000,000,000,0.3),
inset 0px 1px 1px rgba(255,255,255,0.2);
-webkit-box-shadow:
0px 1px 2px rgba(000,000,000,0.3),
inset 0px 1px 1px rgba(255,255,255,0.2);
-webkit-transition-duration: 0.6s;
-moz-transition-duration: 0.6s;
-ms-transition-duration: 0.6s;
-o-transition-duration: 0.6s;
transition-duration: 0.6s;
}
.button:hover,
#button:hover,
#submit:hover,
.edit:hover{
background: -moz-linear-gradient(
top,
#151515 0%,
#151515);
background: -webkit-gradient(
linear, left top, left bottom,
from(#151515),
to(#151515));
-webkit-box-shadow: 0px 0px 8px 5px rgba(222, 222, 222, .95);
-moz-box-shadow: 0px 0px 8px 5px rgba(222, 222, 222, .95);
box-shadow: 0px 0px 8px 5px rgba(222, 222, 222, .95);
}
.add_to_cart_button, .single_add_to_cart_button,
.add_to_cart_button.button, .single_add_to_cart_button.button {
background: -moz-linear-gradient (
top,
#FAB31F 0%,
#F49100) !important;
background: -webkit-gradient(
linear, left top, left bottom,
from(#FAB31F),
to(#F49100)) !important;
border: 1px solid #CE7B00 !important;
}
.add_to_cart_button:hover, .single_add_to_cart_button:hover {
background: -moz-linear-gradient (
top, #F49100 0%,
#F49100);
background: -webkit-gradient(
linear, left top, left bottom,
from(#F49100),
to(#F49100));
border: 1px solid #CE7B00;
-webkit-box-shadow: 0px 0px 8px 5px rgba(253, 213, 128, .75);
-moz-box-shadow: 0px 0px 8px 5px rgba(253, 213, 128, .75);
box-shadow: 0px 0px 8px 5px rgba(253, 213, 128, .75);
}
希望这可以解决!:)
附言:
我已经测试了诸如以下的类:
- a.add_to_cart_button
- a.add_to_cart_button.button
- .add_to_cart_button.button
除了 .add_to_cart_button 类的背景的“!重要”规则无济于事。