changing ToggleButton colors from react-bootstrap(更改Reaction-Bootstrap中的切换按钮颜色)
本文介绍了更改Reaction-Bootstrap中的切换按钮颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序上有一组ToggleButton,我想更改其背景颜色。目前,我的代码为所有按钮提供了<;。untoggled-Button>;的渐变,而未选中的按钮具有该渐变,并添加了一层蓝色薄膜。我有两个问题:我想要移除未切换按钮上的蓝色薄膜,以及我需要访问切换按钮来更改其样式。<;.toggled-Button>;只是一个目前不执行任何操作的占位符。
我想知道如何访问我的CSS中未选中的和选中的版本的ToggleButton,以覆盖默认的引导样式!
JSX:
<ToggleButtonGroup className="view" type="radio" name="options" defaultValue={2}>
<ToggleButton value={1} className="untoggled-button" > title</ToggleButton>
<ToggleButton value={2} className="untoggled-button"> title</ToggleButton>
<ToggleButton value={3} className="untoggled-button"> title</ToggleButton>
</ToggleButtonGroup>
css(这很不正确,但我希望能够同时设置未选中和选中按钮的样式):
.untoggled-button{
background-image: some gradient !important;
}
.toggled-button {
background-image: another gradient !important;
}
推荐答案
将背景颜色设置为透明并添加.active类似乎奏效了!
.untoggled-button{
background-image: some gradient !important;
background-color: transparent !important;
}
. untoggled-button.active {
background-image: another gradient !important;
}
这篇关于更改Reaction-Bootstrap中的切换按钮颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
编程基础网
本文标题为:更改Reaction-Bootstrap中的切换按钮颜色
基础教程推荐
猜你喜欢
- 在 Javascript 中使用 Fetch API 上传文件并显示进度 2022-01-01
- CORS:当凭据标志为真时,无法在 Access-Control-Allow-Origin 中使用通配符 2022-01-01
- HTML5 画布调整为父级 2022-01-01
- 即使每次插入第一个输入的值不同,第二个输入仍显示相同的输入值 2022-01-01
- 带角度的选项卡:仅使用 $http 在单击时加载选项卡 2022-01-01
- 逻辑运算符 ||在 javascript 中,0 代表 Boolean false? 2022-01-01
- 从快速中间件中排除路由 2022-01-01
- 当木偶师打开Chrome时,不能使用Chrome扩展 2022-01-01
- 最佳动态 JavaScript/JQuery 网格 2022-01-01
- 使用 jQuery 在悬停时交换 DIV 类 2022-01-01
