我有以下代码:
<button type="button" class="btn btn-success" onclick="validateForm()">Book appointment</button><br><br>
<p id="submitted" style="background:black"><p>
黑色为按钮,绿色为活动按钮。如何更改此按钮的活动颜色?我已经尝试过多种方法,例如:
.btn.btn-success:active{
background: #933A16;
}
或
btn.btn-success:active{
color #933A16;
}
或
.btn:active{
color: #933A16;
}
没有任何作用。它一直显示为绿色。我不在CSS文件上的其他任何地方都保持绿色。
[首先,我认为您想使用background-color
或background
,我看到您在第一个示例中使用了background
,但在接下来的两个示例中使用了color
。您也可以尝试在分号之前添加!important
语句,以覆盖引导程序的设置。
类似于Burela所说的-添加'!important'将覆盖Bootstrap的默认设置,因此,如果最后将!important设置为您想要的背景色(而不只是背景色),那将是用过的。这是一门新课。另外,字体使用“颜色”,而不是实际的按钮。