提问人:miliRoke 提问时间:10/27/2023 更新时间:10/27/2023 访问量:46
Bootstrap 5:当我点击按钮时,颜色发生了变化
Bootstrap 5: When i clicked my button, the color changed
问:
我使用引导按钮,然后我更改了按钮的颜色。但是当我点击按钮时,它变成了蓝色,即使我写了.btn-primary:active
HTML格式:
<button type="button" class="btn btn-primary">My Button</button>
CSS:
.btn-primary {
background-color: #ffa500;
border: 1px solid #e39400;
}
.btn-primary:hover {
background-color: #e39400;
border: 1px solid #e39400;
}
.btn-primary:active {
background-color: #e39400;
border: 1px solid #e39400;
}
答:
2赞
The Peeps191
10/27/2023
#1
如果要覆盖 Bootstrap 的默认值,可以更改为:.btn-primary:active
.btn-primary:active {
background-color: #e39400 !important;
border: 1px solid #e39400;
}
0赞
Milan Lizriadi
10/27/2023
#2
使用,它应该可以工作!imporant
.btn-primary {
background-color: #ffa500;
border: 1px solid #e39400;
}
.btn-primary:hover {
background-color: #e39400;
border: 1px solid #e39400;
}
.btn-primary:active {
background-color: #e39400 !important;
border: 1px solid #e39400 !important;
}
评论