Responsive Navbar.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Navbar with HTML, CSS, and JS</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>

<!-- Navbar -->
<nav class="navbar">
    <div class="container">
        <a href="#" class="navbar-brand">Logo</a>
        <ul class="navbar-nav">
            <li><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li class="dropdown">
                <button class="dropbtn">Services &#9662;</button>
                <div class="dropdown-content">
                    <a href="#">Service 1</a>
                    <a href="#">Service 2</a>
                    <a href="#">Service 3</a>
                </div>
            </li>
            <li><a href="#">Contact</a></li>
        </ul>
        <button class="menu-toggle" aria-label="Toggle Menu">&#9776;</button>
    </div>
</nav>

<!-- Content Area -->
<div class="content">
    <div class="container">
        <h1>Welcome to our website!</h1>
        <p>This is a responsive navbar created using HTML, CSS, and JS. It adapts its layout for different screen sizes.</p>
       
    </div>
    <div class="">
      <p><a href="https://codezillaye.com/frontend" class="">Codezillaye</a></p>
    </div>
</div>

<!-- JavaScript for Toggle Menu -->
<script>
    const menuToggle = document.querySelector('.menu-toggle');
    const navbarMenu = document.querySelector('.navbar-nav');

    menuToggle.addEventListener('click', () => {
        navbarMenu.classList.toggle('active');
    });
</script>

</body>
</html>
/* Reset styles */
*, *::after,
 *::before {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  
}

/* Navbar styles */
.navbar {
  background-color: #25bdaf;
  color: white;
  padding: 10px 20px;
}

.container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.navbar-brand {
  color: white;
  font-size: 20px;
  text-decoration: none;
}

.navbar-brand:hover {
  opacity: 0.8;
}

.navbar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style-type: none;
}

.navbar-nav li {
  margin-right: 15px;
  position: relative;
}

.navbar-nav li a {
  color: #c74865;
  text-decoration: none;
  padding: 10px 15px;
  transition: 0.3s;
}

.navbar-nav li a:hover {
  background-color: #c7486660;
}
.dropdown {
  position: relative;
}

.dropbtn {
  font-size: 16px;
  background-color: inherit;
  color: white;
  border: none;
  cursor: pointer;
  padding: 10px 15px;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #333;
  min-width: 160px;
  z-index: 1;
}

.dropdown-content a {
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

@media screen and (max-width: 768px) {
  .navbar-nav {
      display: none;
      flex-direction: column;
      position: absolute;
      background-color: #333;
      width: 100%;
      top: 60px;
      left: 0;
      text-align: center;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
      z-index: 1;
  }

  .navbar-nav.active {
      display: flex;
  }

  .navbar-nav li {
      margin-right: 0;
      width: 100%;
  }

  .navbar-nav li a {
      padding: 15px 0;
  }

  .dropdown-content {
      position: static;
      display: none;
      background-color: inherit;
      box-shadow: none;
      width: 100%;
  }

  .dropdown:hover .dropdown-content {
      display: none;
  }

  .menu-toggle {
      display: block;
  }
}