css实现左侧伸缩式菜单栏效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现左侧伸缩式菜单栏效果代码

代码标签: css 伸缩 菜单

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

<!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, shrink-to-fit=no">
    <!-- SEO Meta description -->
    <meta name="description" content="Insha - Css3 Responsive Sidebar Menu">
    <meta name="keywords" content="css, html, css3, html5, responsive, cross browser, navbar, navigation, menu, sidebar, toggle,left menu,clean, minimal">
    <meta name="author" content="epic_theme">


    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/boxicons.min.css">
    <!-- insha style css-->
    <style>
        /*INSHA SIDERBAR MENU STYLE CSS*/
    
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: "Poppins", sans-serif;
    }
    
    body {
        position: relative;
        min-height: 100vh;
        width: 100%;
        overflow: hidden;
    }
    
    ::selection {
        color: #fff;
        background: #00ccff;
    }
    .main {
        position: relative;
        display: flex;
        min-height: 100vh;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 78px;
        background: #00ccff;
        padding: 6px 14px;
        z-index: 99;
        transition: all 0.5s ease;
    }
    
    .sidebar.active {
        width: 240px
    }
    
    .sidebar .logo_content .logo {
        color: #fff;
        display: flex;
        height: 50px;
        width: 100%;
        align-items: center;
        opacity: 0;
        transition: all 0.5s ease;
    }
    
    .sidebar.active .logo_content .logo {
        opacity: 1;
    }
    
    .logo_content .logo i {
        font-size: 28px;
        margin-right: 5px;
    }
    
    .logo_content .logo .logo_name {
        font-size: 20px;
        font-weight: 400;
    }
    
    .logo_content .logo .logo_name a {
        cursor: pointer;
        text-decoration: none;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .sidebar #toggle-menu-btn {
        position: absolute;
        color: #fff;
        top: 6px;
        left: 50%;
        font-size: 22px;
        height: 50px;
        width: 50px;
        text-align: center;
        line-height: 50px;
        transform: translateX(-50%);
        cursor: pointer;
    }
    
    .sidebar.active #toggle-menu-btn {
        left: 90%;
    }
    
    .sidebar ul {
        margin-top: 20px;
    }
    
    .sidebar ul li {
        position: relative;
        height: 50px;
        width: 100%;
        margin: 0 5px;
        list-style: none;
        line-height: 50px;
        margin: 5px 0;
    }
    
    .sidebar ul li .tooltip {
        position: absolute;
        left: 125px;
        top: 0;
        transform: translate(-50%, -50%);
        border-radius: 6px;
        height: 35px;
        width: 120px;
        background: #fff;
        line-height: 35px;
        text-align: center;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        transition: 0s;
        opacity: 0;
        pointer-events: none;
        display: block;
    }
    
    .sidebar.active ul li .tooltip {
        display: none;
    }
    
    .sidebar ul li:hover .tooltip {
        transition: all 0.5s ease;
        opacity: 1;
        top: 50%
    }
    
    .sidebar ul li input {
        position: absolute;
        height: 100%;
        width: 100%;
        left: 0;
        top: 0;
        border-radius: 12px;
        outline: none;
        border: none;
        background: #1d1b31;
        padding-left: 50px;
        font-size: 18px;
        color: #fff;
    }
    
    .sidebar ul li .bx-search {
        position: absolute;
        z-index: 99;
        color: #fff;
        font-size: 22px;
        transition: all 0.5 ease;
    }
    
    .sidebar ul li .bx-search:hover {
        background: #fff;
        color: #1d1b31;
    }
    
    .sidebar ul li a {
        color: #fff;
        display: flex;
        align-items: center;
        text-decoration: none;
        border-radius: 12px;
        white-space: nowrap;
        transition: all 0.4s ease;
    }
    
    .sidebar ul li a:hover {
        color: #00ccff;
        background: #fff;
    }
    
    .sidebar ul li i {
        font-size: 18px;
        font-weight: 400;
        height: 50px;
        min-width: 50px;
        border-radius: 12px;
        line-height: 50px;
        text-align: center;
    }
    
    .sidebar .links_name {
        font-size: 15px;
        font-weight: 400;
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s ease;
    }
    
    .sidebar.active .links_name {
        transition: 0s;
        opacity: 1;
        pointer-events: auto
    }
    
    .sidebar .profile_content {
        position: absolute;
        color: #fff;
        bottom: 0;
        left: 0;
        width: 100%;
    }
    
    .sidebar .profile_content .profile {
        position: relative;
        padding: 10px 6px;
        height: 60px;
        background: none;
        transition: all 0.4s ease;
    }
    
    .sidebar.active .profile_content .profile {
        background: #1d1b31;
    }
    
    .profile_content .profile .profile_details {
        display: flex;
        align-items: center;
        opacity: 0;
        pointer-events: none;
        white-space: nowrap;
        transition: all 0.4s ease;
    }
    
    .sidebar.active .profile_content .profile .profile_details {
        opacity: 1;
        pointer-events: auto;
    }
    
    .profile .profile_details img {
        height: 45px;
        width: 45px;
        object-fit: cover;
        border-radius: 12px;
    }
    
    .profile .profile_details .name_job {
        margin-left: 10px;
    }
    
    .profile .profile_details .name {
        font-size: 15px;
        font-weight: 400;
    }
    
    .profile .profile_details .job {
        font-size: 12px;
    }
    
    .profile #log_out {
        position: absolute;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
        min-width: 50px;
        line-height: 50px;
        font-size: 20px;
        border-radius: 12px;
        text-align: center;
        transition: all 0.4s ease;
       .........完整代码请登录后点击上方下载按钮下载查看

网友评论0