<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type="text/css"> .w3-bar-item ,.w3-button,.w3-bar-block{ background-color:black; color:white; } body{background-color:black;} .w3-teal,.main{ background-color:black; color:red; } </style> </head> <body> <div class="w3-sidebar w3-bar-block w3-card w3-animate-left" style="display:none" id="mySidebar"> <button class="w3-bar-item w3-button w3-large" onclick="w3_close()">Close ×</button> <a href="#" class="w3-bar-item w3-button">Link 1</a> <a href="#" class="w3-bar-item w3-button">Link 2</a> <a href="#" class="w3-bar-item w3-button">Link 3</a> </div> <div id="main"> <div class="w3-teal"> <button id="openNav" class="w3-button w3-teal w3-xlarge" onclick="w3_open()">☰</button> <center><h1>My Page</h1></center> </div> <script> function w3_open() { document.getElementById("main").style.marginLeft = "25%"; document.getElementById("mySidebar").style.width = "25%"; document.getElementById("mySidebar").style.display = "block"; document.getElementById("openNav").style.display = 'none'; } function w3_close() { document.getElementById("main").style.marginLeft = "0%"; document.getElementById("mySidebar").style.display = "none"; document.getElementById("openNav").style.display = "inline-block"; } </script> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more