Minimalist Navigation Bar - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" /> <title>Minimalist Navigation Bar</title> <style> @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap'); body { font-family: 'Open Sans', sans-serif; margin: 0; background: #ffffff; } .navbar { background: #ffffff; border-bottom: 1px solid #eee; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; } .navbar .logo { font-size: 1.5em; color: #333; font-weight: bold; } .navbar ul { list-style: none; display: flex; margin: 0; padding: 0; } .navbar ul li { margin: 0 15px; } .navbar ul li a { color: #333; text-decoration: none; font-size: 1.1em; transition: color 0.3s; } .navbar ul li a:hover { color: #007bff; } .menu-btn { display: none; font-size: 2em; color: #333; cursor: pointer; /* margin-right: 100px; */ } @media (max-width: 768px) { .navbar ul { position: absolute; top: 60px; left: -100%; background: #fff; width: 100%; flex-direction: column; align-items: center; transition: left 0.3s ease; } .navbar ul li { margin: 15px 0; } .menu-btn { display: block; } .navbar ul.active { left: 0; } } </style> </head> <body> <nav class="navbar"> <div class="logo">Minimal</div> <ul> <li><a href="#">Home</a></li> <li><a href="#">Projects</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> </ul> <div class="menu-btn"> <i class="fa fa-bars"></i> </div> </nav> <script> document.querySelector('.menu-btn').addEventListener('click', () => { document.querySelector('.navbar ul').classList.toggle('active'); }); </script> </body> </html>