EkoAI
EkoAI pioneers AI-driven solutions, empowering businesses with intelligent automation and innovation.
Here’s a simple navigation bar with a dropdown menu using HTML, CSS, and JavaScript.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Navbar</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<nav class="navbar">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a>
<ul class="dropdown">
<li><a href="#">Web Design</a></li>
<li><a href="#">App Development</a></li>
</ul>
</li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</body>
</html>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.navbar {
background-color: #333;
overflow: hidden;
}
.navbar ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
}
.navbar li {
position: relative;
}
.navbar a {
color: white;
padding: 14px 20px;
display: block;
text-decoration: none;
}
.navbar a:hover {
background-color: #575757;
}
.dropdown {
display: none;
position: absolute;
background-color: #333;
top: 100%;
left: 0;
}
.navbar li:hover .dropdown {
display: block;
}
const dropdowns = document.querySelectorAll('.navbar li');
dropdowns.forEach(dropdown => {
dropdown.addEventListener('mouseover', () => {
dropdown.querySelector('.dropdown').style.display = 'block';
});
dropdown.addEventListener('mouseout', () => {
dropdown.querySelector('.dropdown').style.display = 'none';
});
});
Customize the navbar to fit your website’s needs.