This Navbar remains fixed on the page as users scroll
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet" /> <div class="sticky-demo-navbar"> <div class="navbar-logo"> <img src="https://cdn-icons-png.flaticon.com/128/2294/2294479.png" alt="Logo" /> <span>Website</span> </div> <a href="#">Home</a> <a href="#">Features</a> <a href="#">Services</a> <a href="#">Our Work</a> </div>
<style> .sticky-demo-navbar { position: sticky; top: 10px; background: #fff; padding: 10px 20px; border: 1px solid #ddd; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); z-index: 10; font-family: 'Poppins', sans-serif; } .navbar-logo { display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 1.2rem; } .navbar-logo img { width: 40px; height: 40px; border-radius: 6px; } .sticky-demo-navbar a { text-decoration: none; color: #000; font-weight: 500; margin-left: 20px; transition: all 0.3s ease; } .sticky-demo-navbar a:hover { color: #ffbb00; transform: translateY(-2px); } body.dark-theme .sticky-demo-navbar { background-color: #222; border-color: #444; } body.dark-theme .sticky-demo-navbar a { color: #90caf9; } body.dark-theme .sticky-demo-navbar a:hover { color: #ffbb00; } body.dark-theme .navbar-logo span { color: white; } </style>
A compact icon which reveals a dropdown of links on clicking. Suitable for mobile
<div class="hamburger-navbar"> <div class="hamburger-top"> <div class="hamburger-left"> <span class="site-name">MyWebsite</span> <img src="https://cdn-icons-png.flaticon.com/128/2294/2294479.png" alt="Logo" class="hamburger-logo"> </div> <div class="hamburger-icon" onclick="toggleHamburger()">☰</div> </div> <div class="hamburger-links" id="hamburgerLinks"> <a href="#">Home</a> <a href="#">Features</a> <a href="#">Services</a> <a href="#">Our Work</a> </div> </div>
<style> .hamburger-navbar { border: 1px solid #ddd; border-radius: 8px; padding: 10px 20px; margin-top: 2rem; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05); font-family: 'Poppins', sans-serif; background-color: #fff; } .hamburger-top { display: flex; justify-content: space-between; align-items: center; } .hamburger-left { display: flex; align-items: center; gap: 10px; } .hamburger-logo { width: 36px; height: 36px; border-radius: 6px; } .hamburger-icon { font-size: 26px; cursor: pointer; user-select: none; } .hamburger-links { display: none; flex-direction: column; align-items: flex-end; margin-top: 10px; } .hamburger-links a { text-decoration: none; color: #000; padding: 6px 0; transition: all 0.3s ease; font-weight: 500; } .hamburger-links a:hover { color: #ffbb00; transform: translateX(5px); } body.dark-theme .hamburger-navbar { background-color: #222; border-color: #444; } body.dark-theme .hamburger-links a { color: #90caf9; } body.dark-theme .hamburger-links a:hover { color: #ffbb00; } body.dark-theme .site-name { color: white; } </style>
<script> function toggleHamburger() { const links = document.getElementById("hamburgerLinks"); links.style.display = links.style.display === "flex" ? "none" : "flex"; } </script>
Tabs like in a browser, with an underline on the active one.
<div class="tab-navbar"> <div class="tab-logo-section"> <span class="site-name">MyWebsite</span> <img src="https://cdn-icons-png.flaticon.com/128/2294/2294479.png" alt="Logo" class="tab-logo"> </div> <div class="tab-links"> <a href="#" class="tab-link active" onclick="setActiveTab(event)">Home</a> <a href="#" class="tab-link" onclick="setActiveTab(event)">Features</a> <a href="#" class="tab-link" onclick="setActiveTab(event)">Services</a> <a href="#" class="tab-link" onclick="setActiveTab(event)">Our Work</a> </div> </div>
<style> .tab-navbar { border-bottom: 2px solid #ddd; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; font-family: 'Poppins', sans-serif; background-color: #f9f9f9; } .tab-logo-section { display: flex; align-items: center; gap: 10px; } .tab-logo { width: 36px; height: 36px; border-radius: 6px; } .site-name { font-size: 1.2rem; font-weight: bold; } .tab-links { display: flex; gap: 25px; } .tab-link { text-decoration: none; color: #555; font-weight: 500; position: relative; padding: 6px 0; } .tab-link::after { content: ''; position: absolute; width: 0%; height: 2px; background-color: #ffbb00; left: 0; bottom: -2px; transition: width 0.3s; } .tab-link:hover::after, .tab-link.active::after { width: 100%; } .tab-link:hover { color: #000; } .tab-link.active { color: #000; } body.dark-theme .tab-navbar { background-color: #222; border-color: #444; } body.dark-theme .tab-link { color: #90caf9; } body.dark-theme .tab-link.active { color: #fff; } body.dark-theme .site-name { color: white; } </style>
<script> function setActiveTab(event) { event.preventDefault() const tabs = document.querySelectorAll('.tab-link'); tabs.forEach(tab => tab.classList.remove('active')); event.target.classList.add('active'); } </script>
Rounded pill-like links with active highlighting.
<div class="pill-navbar"> <div class="pill-logo-section"> <span class="site-name">MyWebsite</span> <img src="https://cdn-icons-png.flaticon.com/128/2294/2294479.png" class="pill-logo" /> </div> <div class="pill-links"> <a href="#" class="pill-link active">Home</a> <a href="#" class="pill-link">Features</a> <a href="#" class="pill-link">Services</a> <a href="#" class="pill-link">Our Work</a> </div> </div>
<style> .pill-navbar { background-color: #fdfdfd; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; font-family: 'Segoe UI', sans-serif; border-bottom: 2px solid #ddd; } .pill-logo-section { display: flex; align-items: center; gap: 10px; } .pill-logo { width: 36px; height: 36px; border-radius: 6px; } .site-name { font-size: 1.2rem; font-weight: bold; color: #333; } .pill-links { display: flex; gap: 18px; } .pill-link { text-decoration: none; padding: 6px 14px; border-radius: 20px; background-color: transparent; color: #555; font-weight: 500; transition: all 0.3s ease; } .pill-link:hover { background-color: #f0f0f0; color: #000; } .pill-link.active { background-color: #ffbb00; color: #fff; } body.dark-theme .pill-navbar { background-color: #1e1e1e; border-color: #333; } body.dark-theme .pill-link { color: #aaa; } body.dark-theme .pill-link.active { background-color: #90caf9; color: black; } body.dark-theme .site-name { color: white; } </style>