1, need to use adjacent sibling selector, pseudo-element selector, pseudo class selector
2, needs the characteristics label label: the user selects the tag, the browser will automatically focus to the label and the associated form controls.
Code Details:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.checkbox1{
display: none;
}
.checkbox1 + i{
display:inline-block;
font-style: normal;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #c0c0c0;
}
.checkbox1:checked +i{
background-color: hotpink;
}
.checkbox1:checked + i::after{
content:' ';
display:inline-block;
margin: 5px;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #fff;
}
</style>
</head>
<body>
<label>
<input type="checkbox" class="checkbox1" >
<i></i>
</label>
</body>
</html>
Did not select the previous renderings:
After selecting renderings: