svg+css实现可折叠垂直菜单导航条代码

代码语言:html

所属分类:菜单导航

代码描述:svg+css实现可折叠垂直菜单导航条代码,点击右侧按钮宽度可缩小。

代码标签: svg css 可折叠 垂直 菜单 导航条 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
   
<head>
       
<meta charset="UTF-8">
<style>
   
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap'); body {
   
margin: 0;
   
background: url('//repo.bfw.wiki/bfwrepo/image/652f365b334c0.png');
   
background-size: cover;
}

* {
   
font-family: 'Inter', sans-serif;
}

div
#Drob_windows {
   
width: 100%;
   
height: 12px;
   
border-radius: 15px 15px 0 0;
   
position: absolute;
   
top: 0;
   
left: 0;
}

div
#Drob_windows_bottom {
   
width: 100%;
   
height: 12px;
   
border-radius: 0 0 15px 15px;
   
position: absolute;
   
bottom: 0;
   
left: 0;
}

div
#Drob_windows_right {
   
width: 12px;
   
height: 100%;
   
border-radius: 0 15px 15px 0;
   
position: absolute;
   
bottom: 0;
   
top: 0;
   
right: 0;
}

div
#Drob_windows_left {
   
width: 12px;
   
height: 100%;
   
border-radius: 15px 0 0 15px;
   
position: absolute;
   
bottom: 0;
   
top: 0;
   
left: 0;
}

div
#Drob_windows:hover, div#Drob_windows_bottom:hover, div#Drob_windows_left:hover, div#Drob_windows_right:hover {
   
cursor: all-scroll;
}

.li_Menu_Title {
   
font-weight: 600;
   
color: white;
   
margin-left: 25px;
   
line-height: 2;
   
transition: 2s;
}

svg
.li_Menu_Icon {
   
width: 30px;
   
height: 30px;
}

li
.li_Menu {
   
display: flex;
   
margin-top: 25px;
}

.TitleTop {
   
color: #a1a6ac;
   
font-size: 0.9rem;
   
padding: 15px 0;
   
position: relative;
}

.MenuSidebar {
   
position: absolute;
   
top: 145px;
   
border-top: 1px solid #6868686b;
   
width: 82%;
}

.WindowsTik {
   
display: flex;
}

.InfoCo {
   
position: absolute;
   
top: 72px;
   
display: flex;
}

.InfoCo_Title {
   
color: white;
   
line-height: 3.3;
   
margin-left: 10px;
   
transition: 2s;
}

.InfoCo_Logo_Box {
   
background-color: white;
   
width: 35px;
   
height: 35px;
   
padding: 8px;
   
border-radius: 100%;
   
position: relative;
}

img
.InfoCo_Logo {
   
width: 30px;
   
height: 30px;
   
margin: auto;
   
position: absolute;
   
left: 0;
   
right: 0;
   
top: 0;
   
bottom: 0;
}

.IconSwitcher {
   
width: 35px;
   
height: 20px;
   
margin: auto;
   
fill: white;
}

.SwitcherSidebar {
   
width: 35px;
   
height: 35px;
   
background-color: rgb(40 40 40 / 34%);
   
position: absolute;
   
right: 29px;
   
float: right;
   
border-radius: 100%;
   
border: 1px solid #ffffff12;
   
line-height: 2.7;
   
cursor: pointer;
}

.TikSidebar {
   
display: flex;
   
padding-top: 11px;
}

.TikSidebar div {
   
width: 15px;
   
height: 15px;
   
margin-right: 10px;
   
border-radius: 100%;
}

.TikSidebar div:nth-child(1) {
   
background: #ff5c4c;
}

.TikSidebar div:nth-child(2) {
   
background: #ffbf38;
}

.TikSidebar div:nth-child(3) {
   
background: #66e14f;
}

.MainSidebar {
   
width: 270px;
   
height: 650px;
   
background-color: rgb(10 10 10 / 34%);
   
backdrop-filter: blur(23px);
   
position: fixed;
   
right: 0;
   
left: 0;
   
top: 34px;
   
bottom: 0;
   
margin: 0 auto;
   
border-radius: 15px;
   
border: 1px solid #ffffff12;
   
padding: 24px 31px;
   
animation-duration: 1s;
}

li
.li_Menu_top:nth-child(1) {
   
margin-top: 0;
}

.KeyMainSidebar {
   
animation-name: MainSidebar;
}

.KeyMainSidebar_back {
   
animation-name: MainSidebar_back;
}

@keyframes MainSidebar {
    from
{
       
width: 270px;
   
}

    to
{
       
width: 27px;
   
}
}

@keyframes MainSidebar_back {
    from
{
       
width: 27px;
   
}

    to
{
       
width: 270px;
   
}
}

</style>
   
</head>
   
<body>
       
<!-- partial:index.partial.html -->
       
<div class="MainSidebar" id="box">
           
<div id="Drob_windows"></div>
           
<div id="Drob_windows_bottom"></div>
           
<div id="Drob_windows_left"></div>
           
<div id="Drob_windows_right"></div>
           
<div>
               
<div class="WindowsTik">
                   
<div class="TikSidebar">
                       
<div></div>
                       
<div></div>
                       
<div></div>
                   
</div>
                   
<div class="SwitcherSidebar">
                       
<svg class="IconSwitcher" xmlns="http://www.w3.org/2000/svg" id="Bold" viewBox="0 0 24 24" width="512" height="512">
                           
<link xmlns="" type="text/css" rel="stylesheet" id="dark-mode-custom-link"/>
                           
<link xmlns="" type="text/css" rel="stylesheet" id="dark-mode-general-link"/>
                           
<style xmlns="" lang="en" type="text/css" id="dark-mode-custom-style" />
                               
<style xmlns="" lang="en" type="text/css" id="dark-mode-native-style"/><style xmlns="" lang="en" type="text/css" id="dark-mode-native-sheet"/><path d="M13.293,18.586,7.707,13a1,1,0,0,1,0-1.414L13.293,6A1,1,0,0,1,15,6.707V17.879A1,1,0,0,1,13.293,18.586Z"/></svg> </div> </div> <div class="InfoCo"> <div class="InfoCo_Logo_Box"> <img class="InfoCo_Logo" src="//repo.bfw.wiki/bfwrepo/icon/652f36b2c1b09.png" alt=""> </div> <div class="InfoCo_Title">Microsoft Design</div> </div> </div> <div class="MenuSidebar"> <div class="TitleTop">MENU</div> <li class="li_Menu li_Menu_top"> <svg class="li_Menu_Icon" xmlns="http://www.w3.org/2000/svg" width="800px" height="800px" viewBox="0 0 24 24" fill="none"><link xmlns="" type="text/css" rel="stylesheet" id="dark-mode-custom-link"/><link xmlns="" type="text/css" rel="stylesheet" id="dark-mode-general-link"/><style xmlns="" lang="en" type="text/css" id="dark-mode-custom-style"/><style xmlns="" lang="en" type="text/css" id="dark-mode-native-style"/><style xmlns="" lang="en" type="text/css" id="dark-mode-native-sheet"/><path d="M3 10C3 7.17157 3 5.75736 3.87868 4.87868C4.75736 4 6.17157 4 9 4H15C17.8284 4 19.2426 4 20.1213 4.87868C21 5.75736 21 7.17157 21 10C21 12.8284 21 14.2426 20.1213 15.1213C19.2426 16 17.8284 16 15 16H9C6.17157 16 4.75736 16 3.87868 15.1213.........完整代码请登录后点击上方下载按钮下载查看

网友评论0