The hamburger sidebar has really taken off in web design. It's that three-line menu icon that keeps things neat and tidy, especially on mobile screens. Let’s check out ten awesome examples of modern hamburger sidebar designs, with some handy code snippets to help you add them to your own projects. We're all about making these sidebars functional, stylish, and user-friendly.
Simple Slide-Out Sidebar
A simple slide-out hamburger sidebar is a great place to start. It's clean, intuitive, and easy to put together. Just click the hamburger icon, and the sidebar slides into view. Here's how you can do it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Slide-Out Sidebar</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Push Content Hamburger Sidebar

This design pushes the main content aside when the sidebar shows up, giving a cool and interactive feel. Here's how you can make it happen:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Push Content Sidebar</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
transition: margin-left .5s;
}
.sidebar {
height: 100%;
width: 250px;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
padding-top: 60px;
transition: 0.5s;
margin-left: -250px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.marginLeft = "0";
document.body.style.marginLeft = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.marginLeft = "-250px";
document.body.style.marginLeft = "0";
}
</script>
</body>
</html>Overlay Hamburger Sidebar
An overlay sidebar covers the main content, making navigation clear and focused. Here's how to set it up:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Overlay Sidebar</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.9);
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "100%";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Hamburger Menu with CSS Animation
Adding CSS animations can jazz up your hamburger sidebar, making it more engaging. Here's a nifty way to do it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hamburger Menu with CSS Animation</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: width 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: color 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
.openbtn span {
display: block;
width: 30px;
height: 2px;
margin: 5px auto;
background-color: white;
transition: all 0.3s;
}
.openbtn.change span:nth-child(1) {
transform: rotate(-45deg) translate(-5px, 6px);
}
.openbtn.change span:nth-child(2) {
opacity: 0;
}
.openbtn.change span:nth-child(3) {
transform: rotate(45deg) translate(-5px, -6px);
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar
<span></span>
<span></span>
<span></span>
</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
document.querySelector(".openbtn").classList.toggle("change");
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
document.querySelector(".openbtn").classList.toggle("change");
}
</script>
</body>
</html>Fullscreen Hamburger Sidebar Menu
For a big impact, try a fullscreen sidebar menu. It takes up the entire screen when opened, offering an immersive navigation experience. Here's how to create one:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fullscreen Sidebar Menu</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "100%";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Hamburger Sidebar with Icons
Adding icons can make your sidebar more user-friendly and visually appealing. This example shows how to use FontAwesome icons in your sidebar menu.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sidebar with Icons</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar a .fa {
margin-right: 10px;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#"><i class="fa fa-home"></i> Home</a>
<a href="#"><i class="fa fa-user"></i> About</a>
<a href="#"><i class="fa fa-briefcase"></i> Services</a>
<a href="#"><i class="fa fa-envelope"></i> Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Dark Themed Hamburger Sidebar
A dark theme can give your sidebar a sleek, modern look. Perfect for sites with a dark color scheme (dark themed sidebar).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dark Themed Sidebar</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
background-color: #333;
color: white;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #444;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #b8b8b8;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #444;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #666;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Including submenus can create a more detailed navigation structure, helping users find what they're looking for quickly.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sidebar with Submenus</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar a.submenu-btn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.submenu {
display: none;
background-color: #333;
padding-left: 20px;
}
.submenu a {
font-size: 20px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="javascript:void(0)" class="submenu-btn" onclick="toggleSubmenu()">Services</a>
<div id="submenu" class="submenu">
<a href="#">Web Design</a>
<a href="#">SEO</a>
<a href="#">Marketing</a>
</div>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
function toggleSubmenu() {
var submenu = document.getElementById("submenu");
submenu.style.display = submenu.style.display === "block" ? "none" : "block";
}
</script>
</body>
</html>Hamburger Sidebar with Profile Section

Adding a profile section in your sidebar can make your site feel more personal and engaging. Here's an example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sidebar with Profile Section</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
.profile-section {
text-align: center;
margin-bottom: 20px;
}
.profile-section img {
border-radius: 50%;
width: 100px;
height: 100px;
}
.profile-section h3 {
color: white;
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<div class="profile-section">
<img src="https://via.placeholder.com/100" alt="Profile Picture">
<h3>John Doe</h3>
</div>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Responsive Hamburger Sidebar
A responsive sidebar adapts to different screen sizes, ensuring a seamless user experience across devices.
<!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>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
overflow-x: hidden;
}
.sidebar {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidebar a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
color: #f1f1f1;
}
.sidebar .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
}
.openbtn {
font-size: 20px;
cursor: pointer;
background-color: #111;
color: white;
padding: 10px 15px;
border: none;
}
.openbtn:hover {
background-color: #444;
}
@media screen and (max-height: 450px) {
.sidebar {padding-top: 15px;}
.sidebar a {font-size: 18px;}
}
</style>
</head>
<body>
<div id="mySidebar" class="sidebar">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav()">☰ Open Sidebar</button>
<script>
function openNav() {
document.getElementById("mySidebar").style.width = "250px";
}
function closeNav() {
document.getElementById("mySidebar").style.width = "0";
}
</script>
</body>
</html>Conclusion
The hamburger sidebar is a handy tool in modern web design. Whether you go for a simple slide-out, a dynamic push content, or an overlay sidebar, there's a style for every site. These examples, complete with code snippets, make it easy to add these features to your own projects. By mixing and matching these designs, you can create a unique and user-friendly navigation experience for your visitors.
The flexibility of the hamburger sidebar allows for seamless integration into various design schemes, ensuring that your website not only looks good but also functions smoothly. Adding a profile section, incorporating icons, or even creating a responsive sidebar can greatly enhance the usability and aesthetic of your site.
The versatility of the hamburger sidebar means it can be tailored to meet the needs of any user, making it a must-have in your web design toolkit. Remember, the key to an effective hamburger sidebar is to ensure it complements your site's overall design while providing intuitive navigation for your users. Keep experimenting with different styles and features to find the perfect fit for your site. Using these hamburger sidebar designs will improve both the usability and visual appeal of your web applications, guaranteeing a seamless and engaging user experience across all devices.
Incorporating a well-designed hamburger sidebar can significantly enhance your site's navigation, making it easier for users to find what they need and ultimately improving their overall experience. So feel free using this examples, get creative, and make your website stand out with a top-notch hamburger sidebar!
