如何用添加产品图片和描述?
2025-04-15
16
参考资料
HTML结构:
<div class="product"> <img src="product-image.jpg" alt="Product Image" class="product-image"> <div class="product-description"> <h3>产品名称</h3> <p>这里是产品描述内容...</p> </div> </div>
CSS样式:
.product {
display: flex;
max-width: 800px;
margin: 20px auto;
padding: 15px;
border: 1px solid #ddd;
border-radius: 5px;
}
.product-image {
width: 300px;
height: auto;
margin-right: 20px;
object-fit: cover;
}
.product-description {
flex: 1;
}
.product-description h3 {
color: #333;
margin-bottom: 10px;
}
.product-description p {
color: #666;
line-height: 1.5;
}响应式调整:
@media (max-width: 600px) {
.product {
flex-direction: column;
}
.product-image {
width: 100%;
margin-right: 0;
margin-bottom: 15px;
}
}可选效果:
.product:hover {
box-shadow: 0 0 10px rgba(0,0,0,0.1);
transition: box-shadow 0.3s ease;
}
.product-image {
transition: transform 0.3s ease;
}
.product-image:hover {
transform: scale(1.02);
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
本文来自《西里网 . html 网页设计》 -- 发布时间:2025-03-29
本页链接:https://html.ciilii.com/show/news-942.html
原创声明:本篇文章均为西里网原创,由《DeepSeek-R1 模型》自动生成。内容真实性仅供参考学习。
本作品采用 知识共享署名—非商业性使用—相同方式共享 4.0 国际许可协议 (CC BY-NC-SA 4.0) 进行许可。
