怎末让着串字显示上去,且在屏幕中间
* {
padding: 0;
margin: 0;
transition: all 0.5s;
}
body {
overflow: hidden;
transform: all 0.5s;
}
.text{
float: right;
}
.navbar {
position: relative;
width: 100vw;
float: left;
}
#checkbox {
display: none;
}
.navbar label {
position: absolute;
top: 0;
left: 70px;
width: 100%;
height: 43px;
font-size: 30px;
color: #5a738e;
background-color: #ededed;
padding-left: 20px;
border: 1px solid #d9dee4;
cursor: pointer;
transition: all 0.5s;
}
.navbar ul {
list-style: none;
width: 70px;
height: 100vh;
background-color: #2a3f54;
overflow: hidden;
}
.navbar ul li {
height: 70px;
margin-bottom: 10px;
}
.navbar ul li:first-child {
display: flex;
justify-content: center;
align-items: center;
padding: 0 10px;
}
.navbar ul li:first-child img {
width: 50px;
height: 50px;
border-radius: 50%;
}
.navbar ul li:first-child span {
color: #fff;
white-space: nowrap;
padding-left: 10px;
display: none;
}
.navbar ul li a {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100%;
color: #d1d1d1;
text-decoration: none;
}
.navbar ul li a i {
font-size: 25px;
margin-bottom: 10px;
}
.navbar ul li a span {
font-size: 12px;
white-space: nowrap;
}
.navbar ul li a:hover {
color: #fff;
background-color: #35495d;
}
.navbar input:checked + label{
left: 200px;
}
.navbar input:checked ~ ul{
width: 200px;
}
.navbar input:checked ~ ul li:first-child{
justify-content: flex-start;transition: all 0.5s;
}
.navbar input:checked ~ ul li:first-child span{
display: block;
}
.navbar input:checked ~ ul li a{
flex-direction: row;
justify-content: flex-start;
}
.navbar input:checked ~ ul li a i{
font-size: 18px;
margin: 0 15px 0 30px;
}
.navbar input:checked ~ ul li a span{
font-size: 14px;
}
<!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>侧边展开导航栏</title>
<link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/index.css">
</head>
<style>
</style>
<body>
<div class="navbar" >
<input type="checkbox" id="checkbox">
<label for="checkbox">
<img src="image/bars.png" width="20" height="20">
</label>
<ul>
<li>
<img src="image/lufei.png" alt="">
<span>欢迎您!同学</span>
</li>
<li>
<a href="index.html">
<img src="image/首页.png" width="20" height="20">
<span>班级首页</span>
</a>
</li>
<li>
<a href="study.html">
<img src="image/学习园地.png" width="20" height="20">
<span>学习园地</span>
</a>
</li>
<li>
<a href="contacts.html">
<img src="image/通讯录%20(1).png" width="20" height="20">
<span>通讯录</span>
</a>
</li>
<li>
<a href="employment.html">
<img src="image/待付款.png" width="20" height="20">
<span>求职就业</span>
</a>
</li>
<li>
<a href="photo.html">
<img src="image/照片.png" width="20" height="20">
<span>班级相册</span>
</a>
</li>
</ul>
</div>
<div class="text">
深度学习西方成功v环保节能喀麦隆,大幅提高v还有八九年喀麦隆,;。‘
</div>
</body>
</html>