网页设计html+css制作一个水果店
时间: 2023-12-18 14:30:08 浏览: 201
以下是制作一个水果店网页的HTML和CSS代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>水果店</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #f5f5f5;
font-family: Arial, sans-serif;
}
header {
background-color: #ff8c00;
color: #fff;
padding: 20px;
text-align: center;
}
h1 {
margin: 0;
font-size: 36px;
}
nav {
background-color: #fff;
border-bottom: 1px solid #ccc;
padding: 10px;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
}
nav li {
margin: 0 10px;
}
nav a {
color: #333;
text-decoration: none;
font-size: 18px;
padding: 10px;
border-radius: 5px;
transition: background-color 0.3s ease;
}
nav a:hover {
background-color: #ccc;
}
section {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 20px;
}
article {
background-color: #fff;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
margin: 20px;
width: 300px;
text-align: center;
border-radius: 5px;
overflow: hidden;
}
article img {
width: 100%;
height: 200px;
object-fit: cover;
}
article h2 {
margin: 10px;
font-size: 24px;
}
article p {
margin: 10px;
font-size: 18px;
color: #666;
}
footer {
background-color: #333;
color: #fff; padding: 20px;
text-align: center;
}
</style>
</head>
<body>
<header>
<h1>水果店</h1>
</header>
<nav>
<ul>
<li><a href="#">首页</a></li>
<li><a href="#">水果</a></li>
<li><a href="#">蔬菜</a></li>
<li><a href="#">关于我们</a></li>
</ul>
</nav>
<section>
<article>
<img src="https://picsum.photos/300/200" alt="水果1">
<h2>水果1</h2>
<p>这是水果1的描述</p>
</article>
<article>
<img src="https://picsum.photos/300/200" alt="水果2">
<h2>水果2</h2>
<p>这是水果2的描述</p>
</article>
<article>
<img src="https://picsum.photos/300/200" alt="水果3">
<h2>水果3</h2>
<p>这是水果3的描述</p>
</article>
<article>
<img src="https://picsum.photos/300/200" alt="水果4">
<h2>水果4</h2>
<p>这是水果4的描述</p>
</article>
</section>
<footer>
<p>版权所有 © 水果店</p>
</footer>
</body>
</html>
```
阅读全文