清除原生样式:
input[type='radio'] {
appearance: none; /* 用于覆盖默认的外观 */
-webkit-appearance: none; /* Safari and Chrome */
-moz-appearance: none; /* Firefox */
}
设置默认选择框样式:
.customRadio {
margin: 0;
margin-right: 8px;
display: inline-block;
width: 20px;
height: 20px;
border-radius: 50%; /* 使其呈圆形 */
border: 2px solid #ccc; /* 默认边框颜色 */
position: relative;
}
设置选中球样式:
/*单选按钮选中后增加的样式*/
> input[type='radio']:checked:before {
content: '';
display: block;
width: 12px;
height: 12px;
background-color: #348930; /* 修改选中状态的颜色 */
border-radius: 50%; /* 使其呈圆形 */
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
标签:样式,50%,radio,选中,input,border From: https://www.cnblogs.com/Simoon/p/18077783