包含导航栏和主体栏的网页
时间: 2024-03-03 09:47:11 浏览: 64
您可以使用 HTML 和 CSS 来创建包含导航栏和主体栏的网页。以下是一个简单的示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<style>
/* 导航栏样式 */
nav {
background-color: #333;
color: #fff;
display: flex;
justify-content: space-between;
padding: 10px;
}
nav ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
nav li {
margin-right: 20px;
}
nav a {
color: #fff;
text-decoration: none;
}
/* 主体栏样式 */
.main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 20px;
}
.card {
background-color: #eee;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.3);
flex-basis: calc(33.33% - 20px);
margin-bottom: 20px;
padding: 20px;
}
</style>
</head>
<body>
<!-- 导航栏 -->
<nav>
<h1>My Website</h1>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<!-- 主体栏 -->
<div class="main">
<div class="card">
<h2>Card 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae nisl ultrices, euismod justo eu, vestibulum elit. Nam nec laoreet purus. Praesent suscipit euismod ligula, a vehicula enim pharetra eu. </p>
</div>
<div class="card">
<h2>Card 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae nisl ultrices, euismod justo eu, vestibulum elit. Nam nec laoreet purus. Praesent suscipit euismod ligula, a vehicula enim pharetra eu. </p>
</div>
<div class="card">
<h2>Card 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae nisl ultrices, euismod justo eu, vestibulum elit. Nam nec laoreet purus. Praesent suscipit euismod ligula, a vehicula enim pharetra eu. </p>
</div>
</div>
</body>
</html>
```
这个示例包含一个简单的导航栏和一个带有三个卡片的主体栏。您可以根据需要进行更改和自定义。
阅读全文