相关疑难解决方法(0)

CSS - 如何设置所选单选按钮标签的样式?

我想为单选按钮的选定标签添加样式:

HTML:

<div class="radio-toolbar">
 <label><input type="radio" value="all" checked>All</label>
 <label><input type="radio" value="false">Open</label>
 <label><input type="radio" value="true">Archived</label>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.radio-toolbar input[type="radio"] {display:none;}
.radio-toolbar label {
    background:Red;
    border:1px solid green;
    padding:2px 10px;
}
.radio-toolbar label + input[type="radio"]:checked { 
    background:pink !important;
}
Run Code Online (Sandbox Code Playgroud)

我有什么想法我做错了吗?

html css css3

127
推荐指数
3
解决办法
29万
查看次数

标签 统计

css ×1

css3 ×1

html ×1