用html和css写商品页
时间: 2024-01-30 14:02:05 浏览: 29
好的,以下是一个简单的商品页示例,包含商品的图片、名称、描述和价格:
```html
<!DOCTYPE html>
<html>
<head>
<title>商品页示例</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.product {
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
.product img {
max-width: 50%;
height: auto;
margin: 0 20px 20px 0;
}
.product h2 {
font-size: 24px;
margin-top: 0;
margin-bottom: 10px;
}
.product p {
font-size: 16px;
margin: 0;
margin-bottom: 10px;
}
.product .price {
font-size: 24px;
font-weight: bold;
color: #f00;
}
</style>
</head>
<body>
<div class="container">
<div class="product">
<img src="product.jpg" alt="商品图片">
<div>
<h2>商品名称</h2>
<p>这里是商品的描述,可以写一些详细的介绍。</p>
<div class="price">¥99.00</div>
</div>
</div>
</div>
</body>
</html>
```
在这个示例中,我们使用了 flexbox 布局来使商品图片和商品信息并排显示。我们也使用了 CSS 的样式来设置字体、颜色、边距和最大宽度等属性。你可以根据自己的需求进行修改。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)