这里只是做一个最简单的展示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>checkbox妙用</title>
<style>
p{
background: red;
}
#a:checked ~ p{
background: green;
}
</style>
</head>
<body>
<input type="checkbox" id="a">
<label for="a"></label>
<p>aaa</p>
</body>
</html>