输入:检查特定的类只

问题描述 投票:0回答:1

我目前做的工作单选按钮,我想改变的背景时,单选按钮被选中

.input:checked + label {
    transition: .5s;
    background: #3498db !important;
    color: white !important;

}

我所做的就是这一点,但其他单选按钮,将有背景。我只想背景加起来也只有一个特定的类。

我也试过

.radio-button-popup input:checked + label {
    transition: .5s;
    background: #3498db !important;
    color: white !important;

}

但它没有工作。这是我的单选按钮结构如何。

<div class="input-group-radio">
    <input type="radio" style="display:none;" name="option-radio-test" class="radio-button-popup" value="test" id="test1">
    <label style=" font-weight: normal !important; padding: 2% !important; border-radius: 5px;" for="test1" class=" input-group-label">Test Radio</label>
</div>

我只希望在单选按钮的类“单选按钮,弹出”这一特定的一组单选按钮的背景。

jquery html css
1个回答
0
投票

就快成功了。你唯一的错误是你选择的媒体链接后输入使用input选择。

.radio-button-popup:checked + label {
    transition: .5s;
    background: #3498db !important;
    color: white !important;

}
<div class="input-group-radio">
    <input type="radio" style="display:none;" name="option-radio-test" class="radio-button-popup" value="test" id="test1">
    <label style=" font-weight: normal !important; padding: 2% !important; border-radius: 5px;" for="test1" class=" input-group-label">Test Radio</label>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.