我试图将我的自定义单选按钮作为其自己的列旁边的label
元素,其中包含多个span
s。使用默认单选按钮很容易实现,但由于自定义样式应用于label:before
,因此它的行为不同。将自定义单选按钮和标签对齐为列
<div class="sp-package-show">
<input type="radio" name="" value="">
<label>
<span>Title</span>
<span>Date</span>
</label>
</div>
[type="radio"] {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
label {
cursor: pointer;
}
[type="radio"] + label {
display: block;
margin-left: 1px;
vertical-align: middle;
}
[type="radio"] + label:before {
content: '';
display: inline-block;
width: 1.1em;
height: 1.1em;
vertical-align: inherit;
border-radius: 1em;
// border: 0.15em solid $gray;
box-shadow: 0 0 0 1px gray;
margin-right: 0.75em;
}
[type="radio"]:checked + label:before {
box-shadow: 0 0 0 0.05em gray;
background-color: gray;
}
演示:https://codepen.io/ourcore/pen/mwRdbx
由包装元素包含的标签和跨度? –
@Paulie_D是的,我已经更新了每个广播节的容器。 –