Html 如何更改引导程序按钮组的活动颜色以使每个按钮具有不同的颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28883397/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:37:44 来源:igfitidea点击:
How to change active color of bootstrap button group to have different color for each button
提问by Phil
When I press the No
button I want it to turn red. I want the Yes
button to behave the way it already does ie. limegreen when active
. How do I do this?
当我按下No
按钮时,我希望它变成红色。我希望Yes
按钮表现得像它已经做的那样,即。青柠时active
。我该怎么做呢?
Please see my fiddle
请看我的小提琴
html
html
<div class="col-sm-5 btn-group" data-toggle="buttons">
<label class="btn btn-info">
<input checked="checked" name="media_release" value="1" type="radio"> Yes
</label>
<label class="btn btn-info active">
<input name="media_release" value="0" type="radio"> No
</label>
</div>
css
css
.btn-info.active {
background-color: limegreen;
}
采纳答案by kadam sunil
.btn-info.active {
background-color: limegreen;
}
.btn_red.active {
background-color: red;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-sm-5 btn-group" data-toggle="buttons">
<label class="btn btn-info">
<input checked="checked" name="media_release" value="1" type="radio"> Yes
</label>
<label class="btn btn-info btn_red">
<input name="media_release" value="0" type="radio"> No
</label>
</div>