Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>首页</title>
<link rel="stylesheet" href="static/css/index.css">
<link rel="stylesheet" href="static/font/jd/iconfont.css">
<style>
</style>
</head>
<body>
<!-- 页眉 -->
<div class="header">
<!-- 字体图标菜单 -->
<div class="menu iconfont icon-caidan"></div>
<!-- 搜索框 -->
<div class="search">
<div class="logo">JD</div>
<div class="zoom iconfont icon-fangdajing-copy "></div>
<input type="text" name="" id="" class="words" value="电钢琴">
</div>
<!-- 登录按钮 -->
<a href="" class="login">登录</a>
<!--固定 -->
<div class="dk">
<div class="gg iconfont icon-gonggong-jingdong"></div>
<a href="">打开APP</a>
</div>
</div>
<!-- 主体 -->
<div class="main">
<div class="bg">
<div class="bg_bc"></div>
<img src="static/images/bg/bg.dpg" alt="">
</div>
<div class="bgtp">
<img src="static/images/bg/bg1.dpg" alt="">
<img src="static/images/bg/bg2.dpg" alt="">
<img src="static/images/bg/bg3.dpg" alt="">
</div>
<!-- 导航区 -->
<ul class="nav">
<li>
<a href=""><img src="static/images/dh/nav-1.png" alt=""></a>
<a href="">京东超市</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-2.png" alt=""></a>
<a href="">数码电器</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-3.png" alt=""></a>
<a href="">京东服饰</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-4.png" alt=""></a>
<a href="">京东生鲜</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-5.png" alt=""></a>
<a href="">京东到家</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-6.png" alt=""></a>
<a href="">充值缴费</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-7.png" alt=""></a>
<a href="">9.9元拼</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-8.png" alt=""></a>
<a href="">领劵</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-9.png" alt=""></a>
<a href="">借钱</a>
</li>
<li>
<a href=""><img src="static/images/dh/nav-10.png" alt=""></a>
<a href="">PLUS会员</a>
</li>
</ul>
<!-- 秒杀区 -->
<div class="ms">
<!-- 头部 -->
<div class="ms-top">
<div class="left">
<div class="title">京东秒杀</div>
<div class="notice">
<div class="tips">10
<img src="static/images/ms/点场.png" alt="">
</div>
<div class="time"><span>00</span>:<span>15</span>:<span>22</span></div>
</div>
</div>
<div class="right">更多秒杀</div>
</div>
<!-- 主体 -->
<ul class="ms-body">
<li class="item">
<a href=""><img src="static/images/ms/1.dpg" alt=""></a>
<div class="iconfont icon-icon-test">338</div>
<div class="iconfont icon-icon-test">558</div>
</li>
<li class="item">
<a href=""><img src="static/images/ms/2.dpg" alt=""></a>
<div class="iconfont icon-icon-test">1859</div>
<div class="iconfont icon-icon-test">2499</div>
</li>
<li class="item">
<a href=""><img src="static/images/ms/3.dpg" alt=""></a>
<div class="iconfont icon-icon-test">4769</div>
<div class="iconfont icon-icon-test">5699</div>
</li>
<li class="item">
<a href=""><img src="static/images/ms/4.dpg" alt=""></a>
<div class="iconfont icon-icon-test">1818</div>
<div class="iconfont icon-icon-test">2199</div>
</li>
<li class="item">
<a href=""><img src="static/images/ms/5.dpg" alt=""></a>
<div class="iconfont icon-icon-test">1399</div>
<div class="iconfont icon-icon-test">1799</div>
</li>
<li class="item">
<a href=""><img src="static/images/ms/6.dpg" alt=""></a>
<div class="iconfont icon-icon-test">20969</div>
<div class="iconfont icon-icon-test">22199</div>
</li>
</ul>
</div>
<!-- 推荐区猜你喜欢 -->
<div class="cnxh">
<img src="static/images/sp/cnxh.png" alt="">
</div>
<ul class="tj">
<li class="item">
<a href=""><img src="static/images/sp/1.webp" alt=""></a>
<p>玉兰油(OLAY)美白润肤面霜50g乳液女士护肤品补水保湿提亮肤色粉嫩白皙改善暗黄美白修护</p>
<div class="price">
<div class="jg iconfont icon-icon-test">59</div>
<div class="mj">满减</div>
<div class="kxs">看相似</div>
</div>
</li>
<li class="item">
<a href=""><img src="static/images/sp/2.webp" alt=""></a>
<p>HR赫莲娜活颜修护舒缓霜 50ml(白绷带 质地面霜 保湿 改善细纹)圣诞节礼物</p>
<div class="price">
<div class="jg iconfont icon-icon-test">3180</div>
<div class="mj">闪购</div>
<div class="kxs">看相似</div>
</div>
</li>
<li class="item">
<a href=""><img src="static/images/sp/3.webp" alt=""></a>
<p>玉兰油(OLAY)锁水布丁水凝霜50g面霜乳液女士护肤品补水保湿提亮肤色淡化细纹水嫩滋润白皙透亮</p>
<div class="price">
<div class="jg iconfont icon-icon-test">199</div>
<div class="mj">满减</div>
<div class="kxs">看相似</div>
</div>
</li>
<li class="item">
<a href=""><img src="static/images/sp/4.webp" alt=""></a>
<p>适用笔记本电脑包手提公文男女12Air13Pro15.6内胆16商务14寸 深空灰 14/15寸</p>
<div class="price">
<div class="jg iconfont icon-icon-test">59</div>
<div class="kxs">看相似</div>
</div>
</li>
<li class="item">
<a href=""><img src="static/images/sp/5.webp" alt=""></a>
<p>//img11.360buyimg.com/jdphoto/s102x28_jfs/t14512/288/2659278877/2368/8468a10d/5aadf9daNd4909ddc.png</p>
<div class="price">
<div class="jg iconfont icon-icon-test">138</div>
<div class="kxs">看相似</div>
</div>
</li>
<li class="item">
<a href=""><img src="static/images/sp/6.webp" alt=""></a>
<p>超媛加绒加厚半高领打底衫女2020新款秋装气质小衫长袖T恤显瘦内搭T血BH-350-B#656#你 棕色 S</p>
<div class="price">
<div class="jg iconfont icon-icon-test">104</div>
<div class="mj">满减</div>
<div class="kxs">看相似</div>
</div>
</li>
</ul>
</div>
<!-- 页脚 -->
<div class="footer">
<a href="">
<div class="iconfont icon-jingdong2"></div>
<span>首页</span>
</a>
<a href="">
<div class="iconfont icon-classification"></div>
<span>分类</span>
</a>
<a href="">
<div class="iconfont icon-jingdongwujiemiandanjiekoupeizhi-01"></div>
<span>京喜</span>
</a>
<a href="">
<div class="iconfont icon-gouwuche1 "></div>
<span>购物车</span>
</a>
<a href="">
<div class="iconfont icon-yonghu"></div>
<span>未登录</span>
</a>
</div>
</body>
</html>
/* 导入公共初始化样式表 */
@import 'reset.css';
/* 页眉 */
.header{
background-color: #e43130;
color: white;
height: 4.4rem;
/* 固定定位 */
position: fixed;
top: 0;
left: 0;
right: 0;
/* 设置层级 */
z-index: 100;
font-size: 1.4rem;
}
/* 页脚 */
.footer{
background-color: #fafafa;
color: #666;
height: 4.4rem;
/* 边框阴影效果 */
box-shadow: 0 0 3px #999;
/* 固定定位 */
position: fixed;
bottom: 0;
left: 0;
right: 0;
font-size: 1.4rem;
}
/* 主体 */
.main{
/* 绝对定位 */
position: absolute;
top: 4.4rem;
bottom: 4.4rem;
left: 0;
right: 0;
font-size: 1.4rem;
}
/* header样式 */
.header{
/* 设置为flex布局 */
display: flex;
/* 垂直居中 */
align-items: center;
}
/* 页眉三部分比例1:6:1 */
.header .login{
color: #fff;
text-align: center;
flex: 1;
}
.header .menu{
text-align: center;
font-size: 3rem;
flex: 1;
}
.header .search{
flex:6;
padding: 0.5rem;
background-color: #fff;
border-radius: 3rem;
display: flex;
}
/* logo */
.header .search .logo{
color: #e43130;
flex: 0 1 4rem;
font-size: 2rem;
/* 水平垂直居中 */
text-align: center;
line-height: 2rem;
}
/* 放大镜 */
.header .search .zoom{
color: #ccc;
flex: 0 1 4rem;
font-size: 2rem;
border-left: 1px solid;
/* 水平垂直居中 */
text-align: center;
line-height: 2rem;
}
/* 搜索文本框 */
.header .search .words{
flex: auto;
/* 去边框 */
border: none;
/* 去轮廓线 */
outline: none;
color: #aaa;
}
/* 固定定位打开APP f32607 */
.header .dk{
background-color: #f32607;
position: fixed;
top: 7rem;
right: 0;
border-radius: 1rem 0 0 1rem;
display: flex;
}
.header .dk .gg{
font-size: 3rem;
}
.header .dk a{
color: #fff;
padding: 0.5rem 1rem 0 0.5rem;
}
/* 固定定位打开APP */
/* header样式 */
.main{
display: flex;
flex-flow: column nowrap;
}
/* 轮播 */
.main .bg{
display: flex;
flex-flow: column nowrap;
background-color: #fff;
position: relative;
height: 15rem;
}
.main .bg .bg_bc{
background-color: #C82519;
border-radius: 0 0 4rem 4em;
height: 10rem;
margin-bottom: 10rem;
}
.main .bg img{
width: 90%;
position: absolute;
top:1rem;
left: 2rem;
right: 2rem;
margin: auto;
border-radius: 1rem;
}
.main .bgtp{
background-color: #fff;
display: flex;
}
.main .bgtp img{
width: 33%;
}
/* 轮播 */
/* 导航区 */
.main .nav{
padding: 1rem;
display: flex;
flex-flow: row wrap;
/* 两端对其 */
justify-content: space-between;
}
.main .nav img{
height: 4rem;
width: 4rem;
}
.main .nav li{
flex: 1 1 20%;
display: flex;
flex-flow: column nowrap;
align-items: center;
margin: 1rem 0;
}
/* 导航区 */
/* 秒杀区 */
/* 头部 */
.main .ms{
background-color: #fff;
padding: 1rem;
margin: 1rem 0;
margin: 0 1rem;
border-radius: 2rem;
}
.main .ms .ms-top{
font-size: 1.3rem;
height: 3rem;
display: flex;
/* 两端对其 */
justify-content: space-between;
}
.main .ms .ms-top .left{
display: flex;
}
.main .ms .ms-top .left .notice{
font-size: 1.1rem;
height: 2rem;
border-radius: 2rem;
margin-left: 1rem;
display: flex;
/* 水平垂直居中 */
justify-content: center;
align-items: center;
}
.main .ms .ms-top .left .notice .tips{
font-size: 1.5rem;
color: #e43130;
padding: 0 0.5rem;
}
.main .ms .ms-top .left .notice .tips img{
width: 2rem;
height: 1.7rem;
}
.main .ms .ms-top .left .time{
font-size: 1.5rem;
color: #e43130;
padding: 0 0.5rem;
}
.main .ms .ms-top .left .time span{
background-color: #e43130;
color: #fff;
border-radius: 0.3rem;
}
.main .ms .ms-top .right{
color: #e43130;
}
/* 主体 */
.main .ms .ms-body{
display: flex;
justify-content: space-between;
}
.main .ms .ms-body img{
height: 5.5rem;
width: 5.5rem;
}
.main .ms .ms-body .item div:first-of-type{
color: #f2270c;
font-size: 1.3rem;
}
.main .ms .ms-body .item div:last-of-type{
color: #999;
font-size: 1.3rem;
text-decoration: line-through;
}
/* 秒杀区 */
/* 推荐区猜你喜欢 */
.main .cnxh img{
width: 100%;
}
.main .tj{
display: flex;
font-size: 1.3rem;
flex-wrap: wrap;
}
.main .tj .item{
flex: 1 1 46%;
background-color: #fff;
overflow: hidden;
display: flex;
flex-flow: column nowrap;
border-radius: 1rem;
padding: 1rem;
position: relative;
}
.main .tj .item p{
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.main .tj .item .price{
display: flex;
}
.main .tj .item .price .jg{
color: #fa2c19;
font-size: 1.6rem;
}
.main .tj .item .price .mj{
margin-left: 1rem;
border: 1px solid #fa2c19;
border-radius: 0.2rem;
font-size: 1.3rem;
margin-top: 0.3rem;
}
.main .tj .item .price .kxs{
position: absolute;
right: 0;
background-color: #f0f2f5;
color: grey;
margin-top: 0.5rem;
border-radius: 1rem 0 0 1rem;
}
.main .tj .item:nth-of-type(odd){
margin: 0.5rem 0.5rem 0.5rem 1rem;
}
.main .tj .item:nth-of-type(even){
margin: 0.5rem 0.5rem 0.5rem 1rem;
}
.main .tj .item img{
width: 100%;
height: 100%;
}
/* 推荐区猜你喜欢 */
/* 菜单栏 */
.footer{
display: flex;
justify-content: space-around;
align-items: center;
}
.footer a{
display: flex;
flex-flow: column nowrap;
align-items: center;
}
.footer a .iconfont{
font-size: 2rem;
}
.footer a span{
font-size: 1rem;
}
/* 菜单栏 */
*{
/* 清理外边距 */
margin: 0;
/* 清理内边距 */
padding: 0;
/* 设置ie盒子 */
box-sizing: border-box;
}
li{
/* 去除小黑点 */
list-style: none;
}
a{
/* 文本颜色 */
color: #7b7b7b;
/* 去掉下划线 */
text-decoration: none;
}
body{
/* 页面背景颜色 */
background-color: #F6F6F6;
}
html{
/* 页面字号 */
font-size: 10px;
}
/* 媒体查询 */
@media screen and (min-width:320px){
html{
/* 页面字号 */
font-size: 8px;
}
}
@media screen and (min-width:375px){
html{
/* 页面字号 */
font-size: 10px;
}
}
@media screen and (min-width:480px){
html{
/* 页面字号 */
font-size: 12px;
}
}
@media screen and (min-width:640px){
html{
/* 页面字号 */
font-size: 14px;
}
}
@media screen and (min-width:720px){
html{
/* 页面字号 */
font-size: 16px;
}
}
@media screen and (min-width:960px){
html{
/* 页面字号 */
font-size: 18px;
}
}
@media screen and (min-width:1024px){
html{
/* 页面字号 */
font-size: 20px;
}
}
总结:
代码中穿插众多flex布局属性及定位知识,通过此案例对前面的知识进行了巩固。