Skip to main content

Exercise 2: Navigation Bar with CSS

Create a horizontal navigation bar with links that change color when you hover over them.

Interactive Solution

DivZone ad link Logo
AI PlatformTurn Code into Customers.Try it free

Solution with complete HTML and CSS code

HTML
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<title>Ejercicio 1</title>
<style>
/* Escribe tu CSS aquí */
nav {
background-color: #333;
overflow: hidden;
}

nav a {
float: left;
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}

nav a:hover {
background-color: #ddd;
color: black;
}
</style>
</head>
<body>
<nav>
<a href="#home">Home</a>
<a href="#services">Services</a>
<a href="#contact">Contact</a>
</nav>
</body>
</html>
info

🔎Review the following sections where you will find more information on this topic: