Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:挺不错, 推荐到群中了
效果展示地址:
仿PHP中文网手机页面
header
、轮播图banner
、导航nav
、主体main
、尾部footer
五大部份。header
: 用户头像、logo 、用户导航,水平排列banner
:可点图片a+imgmain
:主体main分为:推荐课程recomment、最新更新rupdate、最新文章article、最新博文blog、最新问答quan五部分垂直排列。footer
:4个字体图标和说明span水平排列,每个字体图标和说明span垂直排列。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>m.php.cn</title>
<link rel="stylesheet" href="./css/iconfont.css">
<link rel="stylesheet" href="./css/m.php.cn.css">
</head>
<body>
<header>
<a href=""><img src="./img/profilephoto.jpg" alt=""></a>
<a href=""><img src="./img/logo.png" alt=""></a>
<span class="iconfont"></span>
</header>
<div class="banner">
<a href=""><img src="./img/banner.png" alt=""></a>
</div>
<nav>
<ul>
<li>
<a href="">
<img src="./img/html.png" alt="">
<span>HTML/CSS</span>
</a>
</li>
<li>
<a href="">
<img src="./img/JavaScript.png" alt="">
<span>JavaScript</span>
</a>
</li>
<li>
<a href="">
<img src="./img/code.png" alt="">
<span>服务端</span>
</a>
</li>
<li>
<a href="">
<img src="./img/sql.png" alt="">
<span>数据库</span>
</a>
</li>
</ul>
</nav>
<main>
<article class="recommend">
<h3>推荐课程</h3>
<section>
<a href=""><img src="./img/recom1.jpg" alt=""></a>
<a href=""><img src="./img/recom2.jpg" alt=""></a>
</section>
<section>
<div>
<a href=""><img src="./img/recom3.jpg" alt=""></a>
<span>
<a href="">CI框架30分钟极速入门</a>
<span><i>中级</i>61226次播放</span>
</span>
</div>
</section>
</article>
<article class="update">
<h3>最新更新</h3>
<section>
<div>
<a href=""><img src="./img/up1.png" alt=""></a>
<span>
<a href="">PHP快速操控Excel之PhpSpreadsheet</a>
<span>老的PHPExcel已经停止更新了!目前最新的是使用phpOffice插件PhpSpreadsheet...</span>
<span><i>中级</i>15011次播放</span>
</span>
</div>
</section>
</article>
<article class="article">
<h3>最新文章</h3>
<section>
<span>
<a href="">sublime正则搜索替换修改数据的方法</a>
<span><i>发布时间:</i>2020-04-11</span>
</span>
<a href=""><img src="./img/art1.jpg" alt=""></a>
</section>
<section>
<a href="">更多内容</a>
</section>
</article>
<article class="blog">
<h3>最新博文</h3>
<section>
<span>
Jquery+AJAX上传文件,无刷新上传并重命名文件...
</span>
<i>2020-04-11</i>
</section>
<section>
<a href="">更多内容</a>
</section>
</article>
<article class="questions_answers">
<h3>最新问答</h3>
<section>
<span>
制定的学习计划在哪能找到 咋找不到呢?
</span>
<i>2020-04-11</i>
</section>
<section>
<a href="">更多内容</a>
</section>
</article>
</main>
<footer>
<div>
<span class="iconfont"></span>
<span>首页</span>
</div>
<div>
<span class="iconfont"></span>
<span>视频</span>
</div>
<div>
<span class="iconfont"></span>
<span>社区</span>
</div>
<div>
<span class="iconfont"></span>
<span>我的</span>
</div>
</footer>
</body>
</html>
body {
width: 768px;
background-color: #EDEFF0;
margin: auto;
}
/*头部样式*/
header{
width: 768px;
height: 50px;
background-color: #444444;
/*转为flex*/
display: flex;
/*两端对齐*/
justify-content: space-between;
/*垂直方向居中排列*/
align-items: center;
position: fixed;
top: 0;
}
/*设置用户头像/用户导航图标大小*/
header > a:first-of-type > img {
width: 30px;
height: 30px;
border-radius: 50%;
margin: 5px 15px;
}
header > a:nth-of-type(2) > img {
width: 90px;
height: 50px;
margin: 5px 15px;
}
header > .iconfont {
color: white;
font-size: 1.5rem;
margin: 5px 15px;
}
/*轮播图*/
.banner {
display: flex;
margin-top: 0;
}
.banner img {
width: 768px;
height: 280px;
}
/*导航区*/
nav {
background-color: #fff;
display: flex;
/*垂直,不换行*/
flex-flow: column nowrap;
}
nav img {
width: 45px;
height: 49px;
}
nav > ul {
display: flex;
}
nav ul li {
flex: 1;
list-style: none;
}
nav ul li a {
display: flex;
flex-flow: column wrap;
align-items: center;
margin: 10px;
}
nav ul li a span {
margin-top: 5px;
align-items: center;
}
/*主体内容区*/
main {
display: flex;
flex-direction: column;
}
/*推荐课程区*/
main > .recommend {
display: flex;
flex-direction: column;
}
main > .recommend > section:first-of-type {
display: flex;
justify-content: space-around;
background-color: #fff;
}
main > .recommend > section:first-of-type img {
width: 368px;
height: 90px;
}
main > .recommend > section:nth-last-of-type(-n+2) div {
display: flex;
}
main > .recommend > section:nth-last-of-type(-n+2) div img {
width: 295px;
height: 83px;
margin: 8px;
}
main > .recommend > section:nth-last-of-type(-n+2) div > span {
display: flex;
flex-direction: column;
margin: 8px;
}
main > .recommend > section:nth-last-of-type(-n+2) div > span > a {
}
main > .recommend > section:nth-last-of-type(-n+2) div > span > span {
margin-top: 8px;
}
main > .recommend > section:nth-last-of-type(-n+2) div > span > span > i {
width: 30px;
height: 24px;
background-color: #444444;
color: white;
border-radius: 10px;
margin-right: 5px;
}
/*最新更新区*/
main > .update {
display: flex;
flex-direction: column;
}
main > .update img {
width: 299px;
height: 82px;
}
main > .update section {
display: flex;
flex-direction: column;
background-color: #fff;
}
main > .update section > div {
height: 102px;
display: flex;
}
main > .update section > div > span {
display: flex;
flex-direction: column;
font-size: 0.8rem;
margin-left: 15px;
}
main > .update section > div > span > span:first-of-type {
margin: 10px auto;
}
main > .update section > div > span > span:last-of-type i {
background-color: #444444;
color: white;
border-radius: 10px;
margin-right: 5px;
}
/*最新文章*/
main > .article img {
width: 222px;
height: 69px;
}
main > .article {
display: flex;
flex-direction: column;
}
main > .article > section {
display: flex;
justify-content: space-between;
background-color: #fff;
}
main > .article > section > span {
display: flex;
flex-direction: column;
justify-content: space-around;
margin-left: 10px;
}
main > .article > section:last-of-type {
align-self: center;
font-size: 1.2rem;
}
/*最新博文*/
main > .blog {
display: flex;
flex-direction: column;
}
main > .blog > section {
display: flex;
justify-content: space-between;
margin: 5px;
background-color: #fff;
}
main > .blog > section:last-of-type {
align-self: center;
font-size: 1.2rem;
}
/*最新问答*/
main > .questions_answers {
display: flex;
flex-direction: column;
}
main > .questions_answers > section {
display: flex;
justify-content: space-between;
margin: 5px;
background-color: #fff;
}
main > .questions_answers > section:last-of-type {
align-self: center;
font-size: 1.2rem;
}
/*尾部*/
footer {
position: fixed;
bottom: 0;
width: 100%;
height:60px;
min-width: 320px;
max-width: 768px;
/*转为flex*/
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
background-color: #fff;
}
footer > div {
display: flex;
flex-direction: column;
/*justify-content: space-around;*/
margin: auto 15px;
align-items: center;
}
footer > div:first-of-type {
font-size: 1.2rem;
color: red;
}