Advertisement
Guest User

navigationbar con menu hamburger

a guest
Feb 27th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  6. <style>
  7. body {
  8. font-family: Arial, Helvetica, sans-serif;
  9. }
  10.  
  11. .topnav {
  12. overflow: hidden;
  13. background-color: #333;
  14. position: relative;
  15. }
  16.  
  17. .topnav #myLinks {
  18. float: right;
  19. display: none;
  20. }
  21.  
  22. .topnav a {
  23. float: left;
  24. color: white;
  25. padding: 14px 16px;
  26. text-decoration: none;
  27. font-size: 17px;
  28. }
  29.  
  30. .topnav a.icon {
  31. float: right;
  32. }
  33.  
  34. .topnav a:hover {
  35. background-color: #ddd;
  36. color: black;
  37. }
  38.  
  39. .active {
  40. background-color: #4CAF50;
  41. color: white;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46.  
  47. <!-- Simulate a smartphone / tablet look -->
  48. <div>
  49.  
  50. <!-- Top Navigation Menu -->
  51. <div class="topnav">
  52. <a href="#home" class="active">Logo</a>
  53. <div id="myLinks">
  54. <a href="#news">News</a>
  55. <a href="#contact">Contact</a>
  56. <a href="#about">About</a>
  57. </div>
  58. <a href="javascript:void(0);" class="icon" onclick="myFunction()">
  59. <i class="fa fa-bars"></i>
  60. </a>
  61. </div>
  62.  
  63. </div>
  64.  
  65. <script>
  66. function myFunction() {
  67. var x = document.getElementById("myLinks");
  68. if (x.style.display === "block") {
  69. x.style.display = "none";
  70. } else {
  71. x.style.display = "block";
  72. }
  73. }
  74. </script>
  75.  
  76. </body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement