原生js实现tab选项卡切换
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
}
.box{
display: flex;
}
.left li{
border: 1px black solid;
width: 200px;
height: 50px;
text-align: center;
line-height: 50px;
font-size: 25px;
}
.left .active{
background: orange;
}
.left li:hover{
background: orange;
}
.box .right{
flex:1;
border: 1px black solid;
}
.right>div{
font-size: 30px;
display: none;
}
</style>
</head>
<body>
<div class="box">
<div class="left">
<ul class="ul">
<li class="active">首页</li>
<li>博客</li>
<li>程序员学院</li>
<li>下载</li>
</ul>