帮我设计一个关于购物平台的网页,要求附上能在记事本打开的源代码
时间: 2024-06-06 22:11:03 浏览: 181
<!DOCTYPE html>
<html>
<head>
<title>购物平台</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body{
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header{
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
nav{
background-color: #f2f2f2;
padding: 10px;
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
nav a{
color: #333;
text-decoration: none;
font-size: 18px;
padding: 10px;
}
nav a:hover{
background-color: #333;
color: #fff;
}
main{
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-items: flex-start;
padding: 10px;
}
.product{
background-color: #f2f2f2;
margin: 10px;
padding: 10px;
flex-basis: calc(33.33% - 20px);
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.product img{
max-width: 100%;
max-height: 200px;
margin-bottom: 10px;
}
.product h2{
font-size: 18px;
margin: 0;
}
.product p{
font-size: 14px;
margin-top: 5px;
margin-bottom: 10px;
}
.product button{
background-color: #333;
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
font-size: 16px;
margin-bottom: 10px;
}
.product button:hover{
background-color: #fff;
color: #333;
border: 2px solid #333;
}
footer{
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
}
@media screen and (max-width: 768px){
main{
flex-direction: column;
align-items: center;
}
.product{
flex-basis: calc(100% - 20px);
}
}
</style>
</head>
<body>
<header>
<h1>购物平台</h1>
</header>
<nav>
<a href="#">首页</a>
<a href="#">产品</a>
<a href="#">关于我们</a>
<a href="#">联系我们</a>
</nav>
<main>
<div class="product">
<img src="https://via.placeholder.com/300x200.png?text=Product+1" alt="Product 1">
<h2>产品1</h2>
<p>这是一个很棒的产品,你肯定会喜欢。</p>
<button>加入购物车</button>
</div>
<div class="product">
<img src="https://via.placeholder.com/300x200.png?text=Product+2" alt="Product 2">
<h2>产品2</h2>
<p>这是另一个很棒的产品,你也会喜欢。</p>
<button>加入购物车</button>
</div>
<div class="product">
<img src="https://via.placeholder.com/300x200.png?text=Product+3" alt="Product 3">
<h2>产品3</h2>
<p>这是还一个很棒的产品,你也也会喜欢。</p>
<button>加入购物车</button>
</div>
<div class="product">
<img src="https://via.placeholder.com/300x200.png?text=Product+4" alt="Product 4">
<h2>产品4</h2>
<p>这是最后一个很棒的产品,你也也也会喜欢。</p>
<button>加入购物车</button>
</div>
</main>
<footer>
<p>版权所有 © 购物平台</p>
</footer>
</body>
</html>
阅读全文