Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:思路是对的, 这很重要
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>移动端flex首页</title>
<link rel="stylesheet" href="../../font/iconfont.css">
<link rel="stylesheet" href="1227.css">
</head>
<body>
<!--布局原则:宽度自适应,高度固定-->
<!--顶部-->
<header>
<img src="https://img.php.cn/upload/avatar/000/000/001/f917a88f277796c0db13782f48336be9.jpg" alt="" class="user">
<img src="../../image/logo.png" alt="" class="logo">
<a href="">
<i class="iconfont icon-liebiao"></i>
</a>
</header>
<main>
<!--轮播-->
<section class="banner">
<img src="https://m.php.cn/static/images/ico/6.png" alt="">
</section>
<!--导航-->
<nav>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
<a href="">
<img src="https://m.php.cn/static/images/ico/html.png" alt="">
<span>html/css</span>
</a>
</nav>
<section class="course">
<h3>推荐课程</h3>
<div class="course-top">
<a class="course-item">
<img src="https://img.php.cn/upload/course/000/000/001/5d242759adb88970.jpg" alt="">
</a>
<a class="course-item">
<img src="https://img.php.cn/upload/course/000/000/001/5d242759adb88970.jpg" alt="">
</a>
</div>
<div class="course-bottom">
<a>
<img src="https://img.php.cn/upload/course/000/000/035/5d2941e265889366.jpg" alt="">
<div class="course-bottom-right">
<h2>标题</h2>
<div>
<span class="level">中级</span>
<span>454678次播放</span>
</div>
</div>
</a>
<a>
<img src="https://img.php.cn/upload/course/000/000/035/5d2941e265889366.jpg" alt="">
<div class="course-bottom-right">
<h2>标题</h2>
<div>
<span class="level">中级</span>
<span>454678次播放</span>
</div>
</div>
</a>
</div>
</section>
<section class="recent">
<h3>最新更新</h3>
<div class="recent-list">
<a>
<img src="https://img.php.cn/upload/course/000/000/014/5db2b53c67bca626.jpg" alt="">
<div>
<h2>标题</h2>
<p>简述</p>
<div>
<span class="level">中级</span>
<span>454678次播放</span>
</div>
</div>
</a>
<a>
<img src="https://img.php.cn/upload/course/000/000/014/5db2b53c67bca626.jpg" alt="">
<div>
<h2>标题</h2>
<p>简述</p>
<div>
<span class="level">中级</span>
<span>454678次播放</span>
</div>
</div>
</a>
<a>
<img src="https://img.php.cn/upload/course/000/000/014/5db2b53c67bca626.jpg" alt="">
<div>
<h2>标题</h2>
<p>简述</p>
<div>
<span class="level">中级</span>
<span>454678次播放</span>
</div>
</div>
</a>
</div>
</section>
<section class="articles">
<h3>最新文章</h3>
<div class="articles-list">
<a>
<div>
<h2>标题</h2>
<span>发布时间:2019-12-30</span>
</div>
<img src="https://img.php.cn/upload/article/000/000/041/5e0720ee3461b750.jpg" alt="">
</a>
<a>
<div>
<h2>标题</h2>
<span>发布时间:2019-12-30</span>
</div>
<img src="https://img.php.cn/upload/article/000/000/041/5e0720ee3461b750.jpg" alt="">
</a>
<a>
<div>
<h2>标题</h2>
<span>发布时间:2019-12-30</span>
</div>
<img src="https://img.php.cn/upload/article/000/000/041/5e0720ee3461b750.jpg" alt="">
</a>
<a>
<div>
<h2>标题</h2>
<span>发布时间:2019-12-30</span>
</div>
<img src="https://img.php.cn/upload/article/000/000/041/5e0720ee3461b750.jpg" alt="">
</a>
<a href="" class="more">更多内容</a>
</div>
</section>
<section class="blogs">
<h3>最新博文</h3>
<div class="blogs-list">
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="" class="more">更多内容</a>
</div>
</section>
<section class="blogs">
<h3>最新问答</h3>
<div class="blogs-list">
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="">
<h2>composer安装laravel,nginx服务器路配置解决404问题,创建简单的控制器 - 20191227</h2>
<span>2019-12-30</span>
</a>
<a href="" class="more">更多内容</a>
</div>
</section>
</main>
<footer>
<a href="" class="active">
<span><i class="iconfont icon-daohangshouye"></i></span>
<span>首页</span>
</a>
<a href="">
<span><i class="iconfont icon-daohangshouye"></i></span>
<span>视频</span>
</a>
<a href="">
<span><i class="iconfont icon-daohangshouye"></i></span>
<span>社区</span>
</a>
<a href="">
<span><i class="iconfont icon-huiyuan1"></i></span>
<span>我的</span>
</a>
</footer>
</body>
</html>
css代码
/初始化样式/
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: #333;
}
body {
display: flex;
flex-direction: column;
min-width: 360px;
max-width: 768px;
height: 100vh;
width: 100vw;
box-sizing: border-box;
background-color: #edeff0;
}
h3 {
padding-bottom: 10px;
font-size: 18px;
font-weight: bold;
}
/*头部和顶部*/
body>header ,body > footer {
display: flex;
height: 8vh;
width: 100vw;
background-color: darkgray;
}
body > footer{
border-top: 1px solid #cccccc;
}
body>header {
justify-content: space-between;
align-items: center;
box-shadow: 0 0 10px 1px rgba(7, 17, 27, .1);
background-color: #2d353c;
}
body>header>.user {
width: 23px;
height: 23px;
border-radius: 50%;
border: 1px solid #8f9498;
margin-left: 5px;
}
body>header>a>i.iconfont{
font-size: 24px;
color: #fff;
font-weight: bold;
padding-right: 15px;
}
body>header>.logo{
width: 94px;
height: 42px;
display: block;
}
body > footer >a {
background: #eee;
width: 25%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding: 5px 0;
color: #888;
}
body > footer >a.active{
color: red;
}
/*主体*/
body > main {
flex: 1;
overflow-x: hidden;
overflow-y: auto;
display: flex;
flex-direction: column;
/*background-color: #44aaee;*/
}
/*轮播*/
body>main>section.banner {
width: 100vw;
height: 22vh;
}
body>main>section.banner>img {
width: 100%;
height: 100%;
}
/*导航*/
body>main>nav{
background-color: #fff;
width: 100vw;
height: 25vh;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-content: space-between;
}
body>main>nav>a{
width: 25vw;
height: 12.5vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
/*flex-basis: 25%;*/
}
body>main>nav>a>img {
width: 45px;
height: 45px;
margin-bottom: 1vh;
display: block;
}
/*推荐课程*/
body>main>.course {
margin-top: 5vh;
padding: 2.7vw 2.7vw 2.7vw;
}
.course-top {
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 2vh;
}
.course-top>a{
width: 49%;
height: 13vh;
}
.course-top>a>img{
width: 100%;
height: 100%;
}
.course-bottom{
display: flex;
flex-direction: column;
}
.course-bottom>a{
display: flex;
background-color: #fff;
width: 100%;
padding: 9px 0 9px 10px ;
margin-bottom: 20px;
}
.course-bottom>a>img{
height: 80px;
margin-right: 2.5vw;
}
.course-bottom-right>h2{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-bottom: 10px;
font-size: 20px;
color: #888;
}
.course-bottom-right>div{
display: flex;
align-items: center;
width: 100%;
}
.level {
background: #595757;
border-radius: 8px;
color: #fff;
font-size: 10px;
padding: 3px;
line-height: 20px;
margin-right: 5px;
}
/*最新更新*/
body>main>.recent {
padding: 2.7vw 2.7vw 2.7vw;
}
.recent-list>a{
display: flex;
background-color: #fff;
width: 100%;
padding: 9px 0 9px 10px ;
margin-bottom: 20px;
}
.recent-list>a>div>h2{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 20px;
color: #888;
}
.recent-list>a>img{
height: 80px;
margin-right: 2.5vw;
}
.recent-list>a>div>p{
margin-top: 11px;
font-size: 11px;
}
.recent-list>a>div>div{
margin-top: 11px;
}
/*最新文章*/
body>main>.articles {
padding: 2.7vw 2.7vw 2.7vw;
}
.articles-list>a{
display: flex;
background-color: #fff;
border-bottom: 1px solid #eee;
padding: 10px 10px 8px 10px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .1);
justify-content: space-between;
margin-bottom: 10px;
}
.articles-list>a>img{
height: 65px;
width: 30%;
}
.articles-list>a>div>h2{
font-size: 14px;
margin-bottom: 10px;
}
.articles-list>a>div>span{
font-size: 12px;
color: #888;
}
.articles-list>a.more {
justify-content: center;
margin: 0 auto;
line-height: 10px;
background: #fff;
padding: 10px 0;
color: #888;
}
/*最新博文*/
.blogs{
padding: 2.7vw 2.7vw 2.7vw;
}
.blogs-list>a{
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #eee;
padding:10px 10px 8px 10px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .1);
background: #fff;
color: #888888;
margin-bottom: 10px;
}
.blogs-list>a>h2{
font-size: 14px;
font-weight: bold;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 10px;
width: 68%;
}
.blogs-list>a>span{
font-size: 12px;
}
.blogs-list>a.more {
width: 100%;
justify-content: center;
margin: 0 auto;
line-height: 10px;
background: #fff;
padding: 10px 0;
color: #888;
}
效果图
总结
1.css代码有很多重复,没有抽离出来做公共样式
2.布局时简单构思了大致的几个区块,没有细致划分(细致的划分区域可以分离出公共的组件和样式)