时间有限,代码注释不多,有不清楚的地方请私信,我会第一时间回复!!!!!!!!
运行后网页图片:
html 代码:
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小米商品楼层</title>
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/xiaomi.css">
</head>
<body>
<div class="container">
<div class="box">
<div class="left">
<a href="#">
<div class="img1">
<img src="./imgs/xiaimishouji.webp" alt="">
</div>
</a>
</div>
<div class="right">
<ul>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img">
<img src="./imgs/202403201526_60b548a0614d956b2d3667a63d513539.webp" alt="">
</div>
<h2>Xiaomi Civi 4 Pro</h2>
<p class="p1">徕卡光学Summilux镜头 | 5000万徕卡...</p>
<p class="p2">2999元起</p>
</a>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
css 代码:
xiaomi.css
body {
background-color: #f5f5f5;
}
/* .container {
background-color: #fff;
} */
.container .box {
height: 614px;
display: flex;
justify-content: space-between;
}
.container .left {
width: 234px;
height: 614px;
transition: all 0.5s;
}
.img {
width: 234px;
height: 614px;
}
img {
width: 100%;
height: 100%;
}
.right {
width: 978px;
height: 614px;
}
.right ul li {
width: 234px;
height: 300px;
background-color: #fff;
margin-bottom: 14px;
transition: all 0.5s;
/* display: flex;
flex-direction: column;
justify-content: center;
padding: 20px 0;
align-items: center; */
}
h2 {
font-size: 14px;
color: #333;
font-weight: 400;
margin-top: 5px;
/* margin-bottom: 5px; */
}
.img {
width: 160px;
height: 160px;
}
.img img {
margin-top: -15px;
width: 100%;
height: 100%;
}
.p1 {
font-size: 12px;
color: #b0b0b0;
margin-bottom: 15px;
}
.p2 {
font-size: 14px;
color: #ff6700;
}
.right ul li a {
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px 0;
align-items: center;
height: 100%;
}
.right ul {
height: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: space-between;
}
li:hover {
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
margin-top: -1px;
}
.left:hover {
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
margin-top: -1px;
}
common.css
blockquote, body, button, dd, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, hr, input, legend, li, ol, p, pre, td, textarea, th, ul{
margin: 0;
padding: 0;
box-sizing: border-box;
}
li {
list-style-type: none;
}
a {
text-decoration: none;
}
.container {
width: 1226px;
margin: 0 auto;
}
相关引用图片我放在下面,也可去小米官网自行下载