Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <html> <head> <title>Sidebar Navigation Menu Example</title> <style> body { font-family: sans-serif; margin: 0; } /* The sidebar menu */ .sidebar { height: 100%; width: 200px; position: fixed; /* Stay in place */ z-index: 1; top: 0; left: 0; background-color: #111; overflow-x: hidden; /* Disable horizontal scroll */ padding-top: 20px; } /* The sidebar links */ .sidebar a { padding: 10px 15px; text-decoration: none; font-size: 18px; color: #818181; display: block; } /* When you mouse over the navigation links, change their color */ .sidebar a:hover { color: #f1f1f1; background-color: #333; } /* Style page content - use this for the main content area */ .main { margin-left: 200px; /* Same as the width of the sidebar */ padding: 20px; } </style> </head> <body> <nav class="sidebar"> <a href="#">Home</a> <a href="#">Services</a> <a href="#">Clients</a> <a href="#">Contact</a> </nav> <div class="main"> <h2>Main Content</h2> <p>This is the main content area. The sidebar on the left is fixed to the viewport, so it stays in place while you scroll the main content.</p> <p>We used <code>margin-left: 200px;</code> on this content area to ensure that it isn't hidden behind the 200px wide sidebar.</p> </div> </body> </html>