CSS的一些常用样式,如背景、文字、文本、表格、列表等,以及一些常用的场景,如居中对齐、溢出、隐藏元素等。01、常用样式 1.1、background背景 设置元素背景的样式 background,更
顺晟科技
2022-09-13 14:03:41
267
自己制作单选框样式:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- reset.css文件内容参考:https://www.cnblogs.com/lanshanxiao/p/12663192.html -->
<link rel="stylesheet" href="./reset.css">
<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>
</head>
<body>
请选择性别:
<label class="radio-diy">
<input type="radio" name="gender" value="male">
<span class="radiocircle"></span>
<span>男</span>
</label>
<label class="radio-diy">
<input type="radio" name="gender" value="female">
<span class="radiocircle"></span>
<span>女</span>
</label>
</body>
</html>
radio.css
效果展示:

09
2022-11
19
2022-10
30
2022-09
15
2022-09
15
2022-09
15
2022-09