1.手机图文列表实现(仿小米官网)
HTML部分:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="小米文件列表.css">
</head>
<body>
<div class="phone">
<div class="phone_left">
<img src="img/phone0.webp" alt="">
</div>
<div class="phone_right">
<ul class = "phone_ul">
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone1.webp" alt="phone">
</div>
<h3 class = "title">小米10至尊版</h3>
<p class = "desc">120X 变焦/120W秒冲/120Hz屏幕</p>
<p class = "price">
<span class="price1">5299</span>元起
<!--<span class="price2">
<span>2099</span>元
</span>-->
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone2.webp" alt="phone">
</div>
<h3 class = "title">Redmi K30至尊版</h3>
<p class = "desc">120Hz弹出全面屏,天机1000+旗舰处</p>
<p class = "price">
<span class="price1">1999</span>元起
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone3.webp" alt="phone">
</div>
<h3 class = "title">腾讯黑鲨3S</h3>
<p class = "desc">骁龙865处理器,120Hz刷新率</p>
<p class = "price">
<span class="price1">3799</span>元起
<span class="price2">
<span>3999</span>元
</span>
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone4.webp" alt="phone">
</div>
<h3 class = "title">Redmi 9A</h3>
<p class = "desc">5000mAh长循环大电量,6 53"超大护...</p>
<p class = "price">
<span class="price1">599</span>元起
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone5.webp" alt="phone">
</div>
<h3 class = "title">小米10青春版 5G</h3>
<p class = "desc">50倍潜望式变焦/轻薄5G手机</p>
<p class = "price">
<span class="price1">1899</span>元起
<span class="price2">
<span>2099</span>元
</span>
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone6.webp" alt="phone">
</div>
<h3 class = "title">小米10</h3>
<p class = "desc">驿龙865/1亿像素相机</p>
<p class = "price">
<span class="price1">3799</span>元起
<span class="price2">
<span>3999</span>元
</span>
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone7.webp" alt="phone">
</div>
<h3 class = "title">Redmi K30 Pro</h3>
<p class = "desc">双模5G, 骁龙865, 弹出全面屏</p>
<p class = "price">
<span class="price1">2999</span>元起
<span class="price2">
<span>3699</span>元
</span>
</p>
</a>
</li>
<li>
<a href="#">
<div class="phone_img">
<img src="img/phone8.webp" alt="phone">
</div>
<h3 class = "title">Redmi K30 Pro 变焦版</h3>
<p class = "desc">双模5G,骁龙865,弹出全面屏</p>
<p class = "price">
<span class="price1">3399</span>元起
<span class = "price2">
3999元
</span>
</p>
</a>
</li>
</ul>
</div>
</div>
</body>
</html>
CSS部分:
小米文件列表.css
*{
margin:0;
padding:0;
}
body{
/*网页背景颜色*/
background: #F5F5F5;
}
.phone{
/*居中*/
margin: 0 auto;
width: 1226px;
height: 628px;
}
.phone .phone_left{
/*左浮动*/
float:left;
}
.phone .phone_left img{
width:234px;
height: 614px;
}
.phone .phone_right{
width: 992px;
height: 614px;
/*background: #87CFEB;*/
text-align: center;
/*列表浮动*/
float:left;
}
.phone .phone_right .phone_ul li{
width:234px;
height: 260px;
background: #fff;
/*左右0上下20 内边距*/
padding:20px 0;
/*外边距 下左14*/
margin:0 0 14px 14px;
list-style: none;
/*设置li进行浮动*/
float:left;
}
.phone li a{
/*取消文本下划线*/
text-decoration: none;
}
.phone .phone_right li .phone_img{
width:160px;
height:160px;
/*外边距 左右37 下18*/
margin: 0 37px 18px;
}
.phone .phone_right li .phone_img img{
width: 160px;
height:160px;
}
.phone li a{
text-decoration: none;
}
.phone .phone_right li .title{
width:214px;
height: 21px;
font-size: 14px;
color:#333;
margin:0 10px 2px;
font-weight: normal;
}
.phone .phone_right li .desc{
width:214px;
height:18px;
color:#b0b0b0;
font-size: 12px;
margin: 0 10px 10px;
}
.phone .phone_right li .price{
width:214px;
height: 21px;
color:#ff6700;
font-size:14px;
margin:0 10px 14px;
}
.phone .phone_right li .price .price2{
color:#b0b0b0;
text-decoration: line-through;
}