gpt4 book ai didi

html - 如何覆盖 Bootstrap 中主按钮的样式

转载 作者:行者123 更新时间:2023-11-28 16:20:06 26 4
gpt4 key购买 nike

如果我点击单选按钮,我想改变背景颜色。

.btn-primary:hover,
.btn-primary:active,
.btn-primary:visited,
.btn-primary:focus {
background-color: black !important;
color: white !important;
}

.btn-primary {
color: black;
background-color: white;
width: 100%;
}
<div class="btn-group">
<div class="radiobuttonWidth">
<p-radioButton [somethink]="some"> </p-radioButton>
</div>
</div>

悬停效果有效但不活跃

最佳答案

这对我有用。请检查您是否在引导样式导入后定义了 style.css 并使用 !important 覆盖引导样式。

.btn-primary:hover,
.btn-primary:active,
.btn-primary:visited,
.btn-primary:focus {
background-color: black !important;
color: white !important;
}

.btn-primary {
color: white !important;
background-color: green !important;
width: 100%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div class="btn-group">
<div class="radiobuttonWidth">
<button class="btn btn-primary">Test</button>
</div>
</div>

关于html - 如何覆盖 Bootstrap 中主按钮的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53115746/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com