<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
background: #333;
overflow: hidden;
padding: 0;
margin: 0;
}
li {
float: left;
}
li a {
display: block;
color: white;
padding: 14px 20px;
text-decoration: none;
}
li a:hover {
background: #111;
}
</style>
</head>
<body>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</body>
</html>
Explanation:
- A horizontal navbar using
ul
+li
. hover
effect changes background color when mouse is over.
Leave a Reply