Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. body {
  6.     font-family: "Lato", sans-serif;
  7. }
  8.  
  9. .sidenav {
  10.     height: 100%;
  11.     width: 0;
  12.     position: fixed;
  13.     z-index: 1;
  14.     top: 0;
  15.     left: 0;
  16.     background-color: #111;
  17.     overflow-x: hidden;
  18.     transition: 0.5s;
  19.     padding-top: 60px;
  20. }
  21.  
  22. .sidenav a {
  23.     padding: 8px 8px 8px 32px;
  24.     text-decoration: none;
  25.     font-size: 25px;
  26.     color: #818181;
  27.     display: block;
  28.     transition: 1s;
  29. }
  30.  
  31. .sidenav a:hover, .offcanvas a:focus{
  32.     color: #f1f1f1;
  33. }
  34.  
  35. .sidenav .closebtn {
  36.     position: absolute;
  37.     top: 0;
  38.     right: 25px;
  39.     font-size: 36px;
  40.     margin-left: 50px;
  41. }
  42.  
  43. #main {
  44.     transition: margin-left .5s;
  45.     padding: 16px;
  46. }
  47.  
  48. @media screen and (max-height: 450px) {
  49.   .sidenav {padding-top: 15px;}
  50.   .sidenav a {font-size: 18px;}
  51. }
  52. </style>
  53. </head>
  54. <body>
  55.  
  56. <div id="mySidenav" class="sidenav">
  57.   <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
  58.   <a href="#">About</a>
  59.   <a href="#">Services</a>
  60.   <a href="#">Clients</a>
  61.   <a href="#">Contact</a>
  62. </div>
  63.  
  64. <div id="main">
  65.   <h2>Sidenav Push Example</h2>
  66.   <p>Click on the element below to open the side navigation menu, and push this content to the right.</p>
  67.   <span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776; open</span>
  68. </div>
  69.  
  70. <script>
  71. function openNav() {
  72.     document.getElementById("mySidenav").style.width = "250px";
  73.     document.getElementById("main").style.marginLeft = "250px";
  74. }
  75.  
  76. function closeNav() {
  77.     document.getElementById("mySidenav").style.width = "0";
  78.     document.getElementById("main").style.marginLeft= "0";
  79. }
  80. </script>
  81.      
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement