いくつかの単語の男は、直接マップに、言いました:
核となるアイデアは、内部および外部の円黒丸をシミュレートするために、前後のCSS擬似要素を使用して隠された入力要素です。
入力属性リンク特性のラベル要素の巧妙な使用は、入力によって制御される固体内側の円は、プロパティ表示をチェック/クリア
HTML DOM構造:
<label for="onlySelf">
<input type="radio" name="power" id="onlySelf">
<span>仅自己可见</span>
</label>
<label for="onlyDepa">
<input type="radio" name="power" id="onlyDepa">
<span>仅部门可见</span>
</label>
CSS:
<style>
label {
line-height: 30px;
display: flex;
align-items: center;
margin-right: 25px;
font-size: 14px;
color: #666;
}
label span {
display: inline-block;
height: 30px;
line-height: 30px;
padding-left: 24px;
position: relative;
cursor: pointer;
}
label span:before {
content: '';
position: absolute;
width: 18px;
height: 18px;
border: 1px solid #999;
box-sizing: border-box;
border-radius: 50%;
left: 0;
top: 6px;
}
label span:after {
content: '';
position: absolute;
width: 10px;
height: 10px;
background-color: #09f;
box-sizing: border-box;
border-radius: 50%;
left: 4px;
top: 10px;
opacity: 0;
}
label input {
display: none;
}
label input:checked~span:before {
border-color: #09f;
transition: border-color 0.5s ease-in;
}
label input:checked~span:after {
opacity: 1;
transition: opacity 0.3s ease-in;
}
</style>