我想要的样式添加到一个单选按钮的选择标签: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>
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;
}
任何想法我做错了吗?
@Steve是啊,我知道,世界是残酷的......':P' –
似乎在IE8中没有工作。 – Johncl
@Johncl的确如此。 IE8不执行':checked'选择器。 –