
我们直接来看一下具体的实现代码:
html>
<meta>
<meta>
<title>Document</title>
<link>
<style>
.radio-diy .radiocircle {
width: 12px;
height: 12px;
border: 1px solid #999;
border-radius: 50%;
cursor: pointer;
display: inline-block;
}
.radio-diy input:checked+span {
border: 1px solid#008c8c;
}
.radio-diy input:checked~span {
color: #008c8c;
}
.radio-diy input:checked+span.radiocircle::after {
content: "";
display: block;
width: 6px;
height: 6px;
background: #008c8c;
border-radius: 50%;
cursor: pointer;
margin-left: 3px;
margin-top: 3px;
}
input[type="radio"] {
display: none;
}
</style>
请选择性别:
<label>
<input>
<span></span>
<span>男</span>
</label>
<label>
<input>
<span></span>
<span>女</span>
</label>
radio.css
效果展示:

Lightning CSS 是由 Parcel 团队开发的基于 Rust 的 CSS 解析器、转换器、打包工具和压缩工具。此技能适用于需要优化样式表、为目标浏览器降低现代 CSS 语法以及将快速 CSS 处理集成到构建或重构工作流中的代理。
推荐教程:css快速入门
前端入门到VUE实战笔记:立即使用
在学习笔记中,你将探索 前端 的入门与实战技巧!










