html
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>编译中梦见未来</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="channel">
bilibili 编译中梦见未来
</div>
<div class="menu_container">
<input type="checkbox" name="open" id="open">
<label for="open" class="bt">
<span></span>
<span></span>
<span></span>
</label>
<ul class="menu">
<li style="--i:1">
<a href="#">
Home
</a>
</li>
<li style="--i:2">
<a href="#">
About
</a>
</li>
<li style="--i:3">
<a href="#">
Info
</a>
</li>
<li style="--i:4">
<a href="#">
Contact
</a>
</li>
<li style="--i:5">
<a href="#">
Show me more
</a>
</li>
</ul>
</div>
</body>
</html>
css
:root {
--background-color: #7591AD;
--border-color: #7591AD;
--text-color: #34495e;
--color1: #EC3E27;
--color2: #fd79a8;
--color3: #0984e3;
--color4: #00b894;
--color5: #fdcb6e;
--color6: #e056fd;
--color7: #F97F51;
--color8: #BDC581;
}
* {
margin: 0;
padding: 0;
}
html {
font-size: 14px;
}
body {
width: 100vw;
height: 100vh;
background-color: var(--background-color);
display: flex;
justify-content: center;
align-items: center;
font-family: 'Montserrat', sans-serif, Arial, 'Microsoft Yahei';
}
.channel {
position: absolute;
width: 80%;
text-align: center;
top: 50%;
left: 50%;
transform: translate(-50%, -200px);
font-size: 30px;
font-weight: bold;
color: #fff;
}
.menu_container {
position: absolute;
top: 0;
left: 0;
z-index: 9999;
user-select: none;
}
.menu_container input {
position: absolute;
top: -1100px;
left: -1400px;
opacity: 0;
}
.menu_container .bt {
position: absolute;
top: 30px;
left: 30px;
width: 60px;
height: 45px;
z-index: 999;
cursor: pointer;
display: flex;
justify-content: space-between;
flex-direction: column;
}
.menu_container .bt span {
position: relative;
display: block;
width: 100%;
height: 9px;
left: 0;
border-radius: 9px;
background-color: #fff;
opacity: 1;
transition: all 0.5s ease-in-out;
}
.menu_container input:checked~.bt span {
background-color: #666;
}
.menu_container input:checked~.bt span:nth-child(1) {
background-color: #666;
transform: translateY(18px) rotate(-135deg);
}
.menu_container input:checked~.bt span:nth-child(2) {
transform: translateX(60px);
opacity: 0;
}
.menu_container input:checked~.bt span:nth-child(3) {
transform: translateY(-18px) rotate(135deg);
}
.menu_container .menu {
position: absolute;
top: 0;
left: 0;
padding-top: 150px;
width: 300px;
height: calc(100vh - 150px);
transform: translateX(-100%);
background-color: #ededed;
list-style: none;
transition: all 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0);
}
.menu_container input:checked~.menu {
transform: translateX(0px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
}
.menu_container .menu li {
font-size: 24px;
margin: 10px 20px;
transform: translateX(-50px);
opacity: 0;
text-align: right;
}
.menu_container input:checked~.menu li {
transition: all 0.2s ease-out calc(var(--i) * 80ms + 200ms);
transform: translateX(0px);
opacity: 1;
}
.menu_container .menu a {
display: block;
padding-right: 20px;
line-height: 60px;
text-decoration: none;
color: #232323;
background-color: #f1f1f1;
transition: all 0.3s ease;
}
.menu_container .menu a:hover {
color: #f1f1f1;
background-color: var(--background-color);
}