使用html5和css做一个导航栏
时间: 2024-06-04 14:13:51 浏览: 114
html+css导航栏
<!DOCTYPE html>
<html>
<head>
<title>Navigation Bar</title>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, helvetica, sans-serif;
}
nav {
background-color: #333;
color: #fff;
height: 50px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
}
nav ul {
list-style: none;
display: flex;
}
nav ul li {
margin-right: 20px;
}
nav ul li a {
color: #fff;
text-decoration: none;
font-size: 18px;
font-weight: bold;
padding: 0 10px;
line-height: 50px;
transition: all 0.3s ease;
}
nav ul li a:hover {
background-color: #fff;
color: #333;
}
</style>
</head>
<body>
<nav>
<div class="logo">Logo</div>
<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>
</nav>
</body>
</html>
阅读全文