Edit This Code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../lib/w3.css">
<body>

<nav class="w3-sidenav w3-collapse w3-white w3-card-2 w3-animate-left" style="width:200px;">
  <a href="javascript:void(0)" onclick="w3_close()"
  class="w3-closenav w3-large w3-hide-large"
>
Close &times;</a>
  <a href="tryit.asp-filename=tryw3css_ref_sidenav_collapse&stacked=h.html#">Link 1</a>                
  <a href="tryit.asp-filename=tryw3css_ref_sidenav_collapse&stacked=h.html#">Link 2</a>                
  <a href="tryit.asp-filename=tryw3css_ref_sidenav_collapse&stacked=h.html#">Link 3</a>                
  <a href="tryit.asp-filename=tryw3css_ref_sidenav_collapse&stacked=h.html#">Link 4</a>                
  <a href="tryit.asp-filename=tryw3css_ref_sidenav_collapse&stacked=h.html#">Link 5</a>                
</nav>

<div class="w3-main" style="margin-left:200px">
<header class="w3-container w3-teal">
  <span class="w3-opennav w3-xlarge w3-hide-large" onclick="w3_open()">&#9776;</span>
  <h2>Responsive Sidenav</h2>
</header>

<div class="w3-container">
  <p>In this example, the side navigation will always be displayed on desktop computers and laptops (screens wider than 991px), and hidden on tablets and mobile phones (screens less than than 991px).</p>
  <p>On tablets and mobile phones the side navigation is replaced with a menu icon that opens the navigation pane when clicked on: it will then overlay/sit on top of the page content.</p>
  <p><b>Resize the browser window to understand how it works.</b></p>
</div>

<footer class="w3-container w3-teal">
  <h5>Footer</h5>
  <p>Footer information goes here</p>
</footer>
    
</div>

<script>
function w3_open() {
    document.getElementsByClassName("w3-sidenav")[0].style.display = "block";
}
function w3_close() {
    document.getElementsByClassName("w3-sidenav")[0].style.display = "none";
}
</script>
    
</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy