<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>简单导航栏</title>
<style>
/* 重置一些默认样式 */
body, margin, padding {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
}
.navbar {
background-color: #333;
color: #fff;
padding: 10px 0;
}
.container {
width: 80%;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-size: 24px;
text-decoration: none;
color: #fff;
}
.nav-links {
list-style: none;
display: flex;
margin: 0;
padding: 0;
}
.nav-links li {
margin-left: 20px;
}
.nav-links a {
text-decoration: none;
color: #fff;
font-size: 16px;
}
.nav-links a:hover {
text-decoration: underline;
}
main {
padding: 20px;
text-align: center;
}
</style>
</head>
<body>
<nav class="navbar">
<div class="container">
<a href="#" class="logo">我的网站</a>
<ul class="nav-links">
<li><a href="#">首页</a></li>
<li><a href="#">关于我们</a></li>
<li><a href="#">服务</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</div>
</nav>
<main>
<h1>欢迎来到我的网站</h1>
<p>这是一个简单的导航栏示例。</p>
</main>
</body>
</html>
页面展示: