css:
input[type="radio"] + label::before {
content: '';
display: inline-block;
vertical-align: middle;
width: 15px;
height: 15px;
margin-right: 5px;
box-sizing: border-box;
border-radius: 50%;
margin-bottom: 4px;
border: 1px solid #bfcbd9;
}
/* 被选中的单选框样式 给空心圆圈中间加上背景色*/
input[type="radio"]:checked + label::before{
background-color: #178fe6;
background-clip: content-box; /* 规定背景颜色的绘制区域 */
padding: 2px;
}
/* 单选框文字的样式 */
input[type="radio"] + label {
font-size: 13px;
margin-right: 5px;
}
页面元素
<span style="">内容展示范围:</span>
<input type="radio" name="zoom" hidden checked value="all" id="all"><label for="all" onclick="setSelectTime('all')"></label>全部
<input type="radio" name="zoom" hidden value="90" id="month"><label for="month" onclick="setSelectTime('90')"></label>三个月
效果