您的位置:首页 > Web前端 > CSS

自定义input[type=radio]单选框样式

2017-01-17 16:49 531 查看
先看效果:



html结构:

<p>数据是否一致:
<label class="radiobox"><input name="currentRadio" type="radio">是</label>
<label class="radiobox"><input name="currentRadio" type="radio" >否</label>
</p>


css样式:

.radiobox
{
position: relative;
padding-left: 8px;
}
.radiobox:before{
content: '';
display: inline-block;
width: 16px;
height: 16px;
border: 2px solid #999;
border-radius: 50%;
background: #fff;
position: absolute;
top: -2px;
left: 6px;
}
input[type=radio]:checked:before{
content: '';
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #999;
position: absolute;
top: 4px;
left: 12px;
}
input[type=radio]{
margin-right: 6px;
}


so easy。后面有空再写写复选框的样式。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  input 单选框