html div+css购物
时间: 2023-12-19 08:31:35 浏览: 137
购物平台网页(HTML+CSS+JavaScript)
5星 · 资源好评率100%
以下是一个简单的HTML div+css购物页面的例子:
```html
<!DOCTYPE html>
<html>
<head>
<title>购物页面</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
background-color: #f5f5f5;
font-family: Arial, sans-serif;
}
.header {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
font-size: 24px;
}
.container {
margin: 20px auto;
width: 80%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.item {
background-color: #fff;
box-shadow: 0 0 5px rgba(0,0,0,0.3);
margin-bottom: 20px;
width: 30%;
padding: 10px;
text-align: center;
}
.item img {
max-width: 100%;
height: auto;
}
.item h3 {
margin-top: 0;
font-size: 18px;
}
.item p {
margin: 10px 0;
font-size: 14px;
color: #666;
}
.item button {
background-color: #333;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.item button:hover {
background-color: #555;
}
.footer {
background-color: #333;
color: #fff;
padding: 10px;
text-align: center;
font-size: 14px;
}
</style>
</head>
<body>
<div class="header">
<h1>购物页面</h1>
</div>
<div class="container">
<div class="item">
<img src="https://via.placeholder.com/150x150" alt="商品1">
<h3>商品1</h3>
<p>描述1</p>
<button>加入购物车</button>
</div>
<div class="item">
<img src="https://via.placeholder.com/150x150" alt="商品2">
<h3>商品2</h3>
<p>描述2</p>
<button>加入购物车</button>
</div>
<div class="item">
<img src="https://via.placeholder.com/150x150" alt="商品3">
<h3>商品3</h3>
<p>描述3</p>
<button>加入购物车</button>
</div>
<div class="item">
<img src="https://via.placeholder.com/150x150" alt="商品4">
<h3>商品4</h3>
<p>描述4</p>
<button>加入购物车</button>
</div>
<div class="item">
<img src="https://via.placeholder.com/150x150" alt="商品5">
<h3>商品5</h3>
<p>描述5</p>
<button>加入购物车</button>
</div>
<div class="item">
<img src="https://via.placeholder.com/150x150" alt="商品6">
<h3>商品6</h3>
<p>描述6</p>
<button>加入购物车</button>
</div>
</div>
<div class="footer">
<p>版权所有 © 2021 购物页面</p>
</div>
</body>
</html>
```
阅读全文