用html+css写一个小米商城的首页框架布局
时间: 2023-06-11 22:06:44 浏览: 151
html+css仿小米商城首页搜索页和商品详情页
5星 · 资源好评率100%
好的,以下是一个简单的小米商城首页框架布局示例,你可以根据自己的需求进行修改和美化:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>小米商城首页</title>
<style>
/* 全局样式 */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
/* 导航栏样式 */
nav {
background-color: #ff5f3e;
height: 50px;
line-height: 50px;
text-align: center;
color: #fff;
font-size: 20px;
font-weight: bold;
}
nav a {
color: #fff;
text-decoration: none;
}
/* 轮播图样式 */
#carousel {
height: 300px;
background-color: #eee;
position: relative;
}
#carousel img {
width: 100%;
height: 100%;
object-fit: cover;
}
#carousel .carousel-arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
color: #fff;
font-size: 30px;
cursor: pointer;
z-index: 1;
}
#carousel .carousel-arrow.left {
left: 20px;
}
#carousel .carousel-arrow.right {
right: 20px;
}
/* 产品列表样式 */
.product-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
padding: 20px;
background-color: #f5f5f5;
}
.product-item {
width: 230px;
margin: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.product-item img {
width: 100%;
height: 200px;
object-fit: cover;
}
.product-item-info {
padding: 10px;
background-color: #fff;
text-align: center;
}
.product-item-name {
font-size: 16px;
font-weight: bold;
margin-bottom: 10px;
}
.product-item-price {
font-size: 18px;
color: #ff5f3e;
}
/* 底部样式 */
footer {
background-color: #f5f5f5;
height: 100px;
line-height: 100px;
text-align: center;
}
</style>
</head>
<body>
<nav>
<a href="#">小米商城</a>
</nav>
<div id="carousel">
<img src="https://i1.mifile.cn/a4/5b8b721a-9c45-4d08-b4f9-fa88b0f6e6e1" alt="轮播图1">
<img src="https://i1.mifile.cn/a4/882c2a98-3f54-4e1e-8d8b-0fb3d6d4a3c2" alt="轮播图2">
<img src="https://i1.mifile.cn/a4/a3ce1ab9-44a9-448d-b9b1-ec0a138f6f41" alt="轮播图3">
<div class="carousel-arrow left"><</div>
<div class="carousel-arrow right">></div>
</div>
<div class="product-list">
<div class="product-item">
<img src="https://i1.mifile.cn/a4/xmad_15130289368908_rBgTt.jpg" alt="商品1">
<div class="product-item-info">
<div class="product-item-name">小米10 至尊纪念版</div>
<div class="product-item-price">5299元</div>
</div>
</div>
<div class="product-item">
<img src="https://i1.mifile.cn/a4/xmad_15913133654261_uNfuK.jpg" alt="商品2">
<div class="product-item-info">
<div class="product-item-name">Redmi 9A</div>
<div class="product-item-price">599元</div>
</div>
</div>
<div class="product-item">
<img src="https://i1.mifile.cn/a4/xmad_15876434959106_HjQFk.jpg" alt="商品3">
<div class="product-item-info">
<div class="product-item-name">小米无线充电宝</div>
<div class="product-item-price">99元</div>
</div>
</div>
<div class="product-item">
<img src="https://i1.mifile.cn/a4/xmad_15936290436203_QwGae.jpg" alt="商品4">
<div class="product-item-info">
<div class="product-item-name">小米手环5</div>
<div class="product-item-price">189元</div>
</div>
</div>
<div class="product-item">
<img src="https://i1.mifile.cn/a4/xmad_15952873615582_WWbRg.jpg" alt="商品5">
<div class="product-item-info">
<div class="product-item-name">小米电视4A</div>
<div class="product-item-price">1499元</div>
</div>
</div>
<div class="product-item">
<img src="https://i1.mifile.cn/a4/xmad_15937551470785_eJXpM.jpg" alt="商品6">
<div class="product-item-info">
<div class="product-item-name">RedmiBook 14</div>
<div class="product-item-price">3799元</div>
</div>
</div>
</div>
<footer>
© 2021 小米科技有限公司 版权所有
</footer>
</body>
</html>
```
阅读全文