写一个关于旅游网站的css代码
时间: 2024-03-21 07:44:37 浏览: 16
以下是一个简单的关于旅游网站的 CSS 代码示例,它包括网页头部、导航栏、轮播图、旅游产品列表和页脚等基本元素的样式:
```css
/* 网页头部样式 */
header {
background-color: #fff;
height: 80px;
padding: 10px;
box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}
header h1 {
font-size: 30px;
font-weight: bold;
color: #333;
}
/* 导航栏样式 */
nav {
background-color: #f8f8f8;
height: 50px;
padding: 10px;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
}
nav li {
margin-right: 20px;
}
nav a {
display: block;
text-decoration: none;
font-size: 18px;
color: #333;
padding: 10px;
}
nav a:hover {
background-color: #333;
color: #fff;
}
/* 轮播图样式 */
.slider {
position: relative;
height: 400px;
overflow: hidden;
}
.slider img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
/* 旅游产品列表样式 */
.product-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 20px 0;
}
.product {
width: calc(33.33% - 10px);
margin-bottom: 20px;
}
.product img {
width: 100%;
}
.product h3 {
font-size: 18px;
font-weight: bold;
margin: 10px 0;
}
.product p {
font-size: 14px;
line-height: 1.5;
margin-bottom: 10px;
}
.product button {
background-color: #333;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
/* 页脚样式 */
footer {
background-color: #333;
color: #fff;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
}
footer p {
font-size: 14px;
text-align: center;
}
```
以上代码只是示例,实际项目中需要根据具体设计制定样式。