HTMLify
Best Navigation Bar
Views: 455 | Author: djdj
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Responsive Sidebar</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, sans-serif; } body { display: flex; } .sidebar { width: 250px; background: #18191A; color: white; height: 100vh; padding: 20px; position: fixed; transition: width 0.3s; } .sidebar.close { width: 70px; } .sidebar .logo { display: flex; align-items: center; justify-content: space-between; } .sidebar.close .logo h2 { display: none; /* Logo text hidden when sidebar is closed */ } .sidebar .logo i { font-size: 24px; cursor: pointer; } .menu { margin: 20px -10px; } .menu li { list-style: none; padding: 15px; display: flex; align-items: center; cursor: pointer; } .menu li:hover { background: #242526; border-radius: 10px; } .menu i { font-size: 20px; margin-right: 10px; } .menu span { transition: opacity 0.3s; } .sidebar.close .menu span { opacity: 0; pointer-events: none; } .content { margin-left: 250px; padding: 20px; transition: margin-left 0.3s; width: 100%; } .sidebar.close + .content { margin-left: 70px; } .fa-bars:before, .fa-navicon:before { margin-left: 5px; } </style> </head> <body> <div class="sidebar"> <div class="logo"> <h2>SabkaCode</h2> <i class="fas fa-bars" id="toggle"></i> </div> <ul class="menu"> <li><i class="fas fa-search"></i> <span>Search</span></li> <li><i class="fas fa-home"></i> <span>Dashboard</span></li> <li><i class="fas fa-user"></i> <span>User</span></li> <li><i class="fas fa-envelope"></i> <span>Messages</span></li> <li><i class="fas fa-chart-bar"></i> <span>Analytics</span></li> <li><i class="fas fa-folder"></i> <span>File Manager</span></li> <li><i class="fas fa-shopping-cart"></i> <span>Order</span></li> <li><i class="fas fa-heart"></i> <span>Saved</span></li> <li><i class="fas fa-cog"></i> <span>Settings</span></li> </ul> </div> <div class="content"> <h1>Dashboard</h1> <p>Welcome to your dashboard!</p> </div> <script> document.getElementById('toggle').addEventListener('click', function() { document.querySelector('.sidebar').classList.toggle('close'); }); </script> </body> </html> |