<!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>Document</title>
<style>
* {
padding: 0;
margin: 0;
text-decoration: none;
list-style: none;
}
ul {
width: 400px;
height: 400px;
margin: 50px auto;
background-color: pink;
position: relative;
}
input {
display: none;
}
label {
float: left;
width: 100px;
height: 40px;
border: 1px solid red;
}
.box1 {
position: absolute;
width: 100%;
height: 358px;
background-color: #bfa;
top: 41px;
font-size: 50px;
text-align: center;
line-height: 358px;
color: #fff;
visibility: hidden;
}
input:checked ~ .box1 {
visibility: visible;
}
</style>
</head>
<body>
<ul>
<li>
<input type="radio" name="tab" id="tab1" checked />
<label for="tab1">1</label>
<div class="box1">
</div>
</li>
<li>
<input type="radio" name="tab" id="tab2" />
<label for="tab2">2</label>
<div class="box1">选项二内容</div>
</li>
<li>
<input type="radio" name="tab" id="tab3" />
<label for="tab3">选项三</label>
<div class="box1">选项三内容</div>
</li>
</ul>
</body>
</html>