Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 703 Bytes

README.md

File metadata and controls

16 lines (10 loc) · 703 Bytes

Navbar-open-and-close-menu

  • Here is an example of how to create a navigation bar with a "hamburger" menu icon that toggles the display of the navigation items on smaller screens using HTML, CSS, and JavaScript:

  • In this example, the nav-items class is initially set to display: none in a media query for screens smaller than 600px. When the hamburger icon is clicked, the JavaScript function toggleNav() is called, which uses the classList.toggle() method to add or remove the class "show-nav" to the nav-items element. You can then use CSS to define the styles for the "show-nav" class, such as display: block, to show the navigation items when the hamburger icon is clicked.