61,112
社区成员
发帖
与我相关
我的任务
分享
<style>
input[type="radio"] + label::before {
content: "\a0"; /*不换行空格*/
display: inline-block;
vertical-align: middle;
font-size: 18px;
width: 1em;
height: 1em;
margin-right: .4em;
border-radius: 50%;
border: 1px solid #01cd78;
text-indent: .15em;
line-height: 1;
}
input[type="radio"]:checked + label::before {
background-color: #01cd78;
background-clip: content-box;
padding: .2em;
}
input[type="radio"] {
position: absolute;
clip: rect(0, 0, 0, 0);
}
</style>
<div class="female">
<input type="radio" id="female" name="sex" />
<label for="female">女</label>
</div>
<div class="male">
<input type="radio" id="male" name="sex" />
<label for="male">男</label>
</div>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
input[type="radio"] {
display: none;
}
input[type="radio"]+span {
display: inline-block;
width: 25px;
height: 25px;
vertical-align: middle;
border-radius: 50%;
border: 1px solid #999;
background-color: #fff;
}
input[type="radio"]:checked+span {
width: 15px;
height: 15px;
border: 6px solid #39f;
background-color: #fff;
}
</style>
</head>
<body>
<label><input type="radio" name="test" /><span></span>选项A</label><br />
<label><input type="radio" name="test" /><span></span>选项B</label><br />
<label><input type="radio" name="test" checked="checked" /><span></span>选项C</label><br />
</body>
</html>