1/将PHP中文网移动端剩余部分的内容写完
demo2.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>仿PHP中文网手机版首页</title>
<link rel="stylesheet" href="css/style2.css">
</head>
<body>
<header>
<img src="css/images/user-pic.jpeg" alt="">
<img src="css/images/logo.png" alt="">
<img src="css/images/user-nav.jpg" alt="">
</header>
<div class="banner">
<img src="css/images/banner.jpg">
</div>
<nav> /*设置一个导航*/
<ul> /*第一排导航*/
<li>
<a href="">
<img src="css/images/html.png" alt=""> /*图片链接*/
<span>HTML/CSS</span> /*图片对应的名称*/
</a>
</li>
<li>
<a href="">
<img src="css/images/JavaScript.png" alt="">
<span>JavaScript</span>
</a>
</li>
<li>
<a href="">
<img src="css/images/code.png" alt="">
<span>服务端</span>
</a>
</li>
<li>
<a href="">
<img src="css/images/sql.png" alt="">
<span>数据库</span>
</a>
</li>
</ul>
<ul>
<li>
<a href="">
<img src="css/images/app.png" alt="">
<span>移动端</span>
</a>
</li>
<li>
<a href="">
<img src="css/images/manual.png" alt="">
<span>手册</span>
</a>
</li>
<li>
<a href="">
<img src="css/images/tool2.png" alt="">
<span>工具</span>
</a>
</li>
<li>
<a href="">
<img src="css/images/live.png" alt="">
<span>直播</span>
</a>
</li>
</ul>
</nav>
<main>
<div class="recommend">
<h3>推荐课程</h3>
<section>
<a href=""><img src="css/images/tjkc1.jpg" alt=""></a>
<a href=""><img src="css/images/tjkc2.jpg" alt=""></a>
</section>
<section>
<div>
<a href=""><img src="css/images/tjkc3.jpg" alt=""></a>
<span>
<a href="">C框架30分钟极速入门</a>
<span><i>中级</i>52972次播放</span>
</span>
</div>
<div>
<a href=""><img src="css/images/tjkc4.jpg" alt=""></a>
<span>
<a href="">2018前端入门_HTML5</a>
<span><i>初级</i>256398次播放</span>
</span>
</div>
</section>
<h3>最新更新</h3>
<section>
<div>
<a href=""><img src="css/images/zxgx1.jpg" alt=""></a>
<span>
<a href="">2019pytho自学视频</a>
<span>本课程适合想从零开始学习python编程语言的开发人员。由浅入深的带...</span>
<span><i>初级</i>11941次播放</span>
</span>
</div>
<div>
<a href=""><img src="css/images/zxgx2.png" alt=""></a>
<span>
<a href="">PHP开发免费公益直播课</a>
<span>主讲:php中文网-朱老师(Peter Zhu)时间:2019.10.17 晚 20:00-22:00...</span>
<span><i>初级</i>3634次播放</span>
</span>
</div>
<div>
<a href=""><img src="css/images/zxgx3.jpg" alt=""></a>
<span>
<a href="">从零开始到WEB响应式布局</a>
<span>重点介绍了HTML/CSS/web布局前段核心技术,通过视频讲解,了解...</span>
<span><i>初级</i>11206次播放</span>
</span>
</div>
<div>
<a href=""><img src="css/images/zxgx4.png" alt=""></a>
<span>
<a href="">PHP文件基础操作</a>
<span>好多同学在PHP基础的时候对PHP文件的操作了解的不够多,本节课就带...</span>
<span><i>中级</i>4179次播放</span>
</span>
</div>
<div>
<a href=""><img src="css/images/zxgx5.jpg" alt=""></a>
<span>
<a href="">memcache基础课程</a>
<span>本课程带你从零认识memcache,让你在一小时左后轻松掌握memcache...</span>
<span><i>初级</i>1794次播放</span>
</span>
</div>
<div>
<a href=""><img src="css/images/zxgx6.png" alt=""></a>
<span>
<a href="">微信小程序--企业微网站</a>
<span>1,介绍小程序/开发者工具 2,介绍小程序文档 3,微官网项目 4,首页...</span>
<span><i>初级</i>7997次播放</span>
</span>
</div>
</section>
<h3>最新文章</h3>
<section>
<div>
<span>
<a href="">linux的mysql配置文件在哪</a>
<a href="">发布时间:2019-12-26</a>
</span>
<a href=""><img src="css/images/zxwz1.png" alt=""></a>
</div>
<div>
<span>
<a href="">linux命令行中如何同时执行多个命令</a>
<a href="">发布时间:2019-12-26</a>
</span>
<a href=""><img src="css/images/zxwz2.jpg" alt=""></a>
</div>
<div>
<span>
<a href="">phpmyadmin需要付费吗</a>
<a href="">发布时间:2019-12-26</a>
</span>
<a href=""><img src="css/images/zxwz3.jpg" alt=""></a>
</div>
<div>
<span>
<a href="">Nginx缓存使用</a>
<a href="">发布时间:2019-12-26</a>
</span>
<a href=""><img src="css/images/zxwz4.jpg" alt=""></a>
</div>
<div>
<span>
<a href="">PHP文字生成透明图片之路</a>
<a href="">发布时间:2019-12-26</a>
</span>
<a href=""><img src="css/images/zxwz5.jpg" alt=""></a>
</div>
<div>
<a href="">更多内容</a>
</div>
</section>
<h3>最新博文</h3>
<section>
<div>
<span>
<a href="">转载《PHP安全之道》学习笔记1:PHP项目安全设置</a>
<a href="">2019-12-25</a>
</span>
</div>
<div>
<span>
<a href="">关于双列排版自适应问题:(左侧固定,右侧自适应)成功,(右侧...</a>
<a href="">2019-12-24</a>
</span>
</div>
<div>
<a href="">更多内容</a>
</div>
</section>
<h3>最新问答</h3>
<section>
<div>
<span>
<a href="">echo是遍历所有元素的对象</a>
<a href="">2019-12-25</a>
</span>
</div>
<div>
<span>
<a href="">关于tp5.0向小程序返回json格式数据异常问题</a>
<a href="">2019-12-25</a>
</span>
</div>
<div>
<span>
<a href="">想看以前的课程怎么办,</a>
<a href="">2019-12-25</a>
</span>
</div>
<div>
<span>
<a href="">hr样式</a>
<a href="">2019-12-25</a>
</span>
</div>
<div>
<span>
<a href="">谁能告诉我php7+tp5.1时遇到使用session::set()问题</a>
<a href="">2019-12-24</a>
</span>
</div>
<div>
<a href="">更多内容</a>
</div>
</section>
</div>
</main>
<footer>
<div>
<a href=""><img src="css/font-icon/zhuye.png">首页</a>
<a href=""><img src="css/font-icon/video.png">视频</a>
<a href=""><img src="css/font-icon/luntan.png">社区</a>
<a href=""><img src="css/font-icon/geren.png">我的</a>
</div>
</footer>
</body>
</html>
init.css
body,footer{
min-width: 320px;
max-width: 768px;
margin: 0 auto;
background-color: #edeff0;
overflow-y: initial;
position: relative;
color: gray;
overflow: hidden;
-webkit-tap-highlight-color: transparent;
}
img{
width: 100%;
}
ul,li{
margin: 0;
padding: 0;
}
li{
list-style: none;
}
a{
text-decoration: none;
color: gray;
}
style2.css
@import"init.css";
header{
position: fixed;
top:0;
width: 100%;
height: 42px;
background-color: #444444;
color: white;
min-width: 320px;
max-width: 768px;
display: flex;
justify-content: space-between;
align-items: center;
}
header>img:first-of-type,
header>img:last-of-type{
width: 26px;
height: 26px;
margin: 5px;
}
header>img:first-of-type{
border-radius: 50%;
}
header>img{
width: 94px;
}
.banner{
display: flex;
height: 200px;
}
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;
}
nav ul li a{ /*设置a标签样式*/
display: flex;
flex-flow: column wrap;
align-items: center; /*设置导航与纵轴排列样式*/
margin: 10px;
}
nav ul li a span{
margin-top: 5px;
}
main{
display: flex;
flex-flow: column nowrap;
}
main>.recommend>section:first-of-type{
display: flex;
}
main>.recommend>section:first-of-type>a{
margin: 5px;
flex: 1;
}
main>.recommend>section:first-of-type>a>img{
height: 90px;
}
main>.recommend>section:nth-of-type(2){
display: flex;
flex-flow: column nowrap;
}
main>.recommend>section:nth-of-type(2)>div{
background-color: #fff;
margin: 5px;
display: flex;
}
main>.recommend>section:nth-of-type(2)>div img{
width: 350px;
height: 90px;
}
main>.recommend>section:nth-of-type(2)>div>span{
display: flex;
flex-flow: column nowrap;
margin-top: 5px;
padding-left: 10px;
}
main>.recommend>section:nth-of-type(2)>div>span i{
font-style: normal;
background-color: #333333;
color: white;
border-radius: 4px;
padding: 0 5px;
font-size: smaller;
}
main>.recommend>section:nth-of-type(3){
display: flex;
flex-flow: column nowrap;
}
main>.recommend>section:nth-of-type(3)>div{
display: flex;
background-color: #fff;
margin: 5px;
}
main>.recommend>section:nth-of-type(3)>div img{
width: 350px;
height: 90px;
}
main>.recommend>section:nth-of-type(3)>div>span{
display: flex;
flex-flow: column nowrap;
margin-top: 5px;
padding-left: 10px;
}
main>.recommend>section:nth-of-type(3)>div>span i{
font-style: normal;
background-color: #333333;
color: white;
border-radius: 4px;
padding:0 5px;
font-size: smaller;
}
main>.recommend>section:nth-of-type(4){
display: flex;
flex-flow: column nowrap;
}
main>.recommend>section:nth-of-type(4)>div{
display: flex;
background-color: #fff;
margin: 5px;
}
main>.recommend>section:nth-of-type(4)>div img{
width: 200px;
height: 90px;
float: right;
}
main>.recommend>section:nth-of-type(4)>div>span{
display: flex;
flex: 1;
flex-flow: column nowrap;
margin-top: 10px;
padding-left: 10px;
}
main>.recommend>section:nth-of-type(4)>div:last-child>a{
display: flex;
flex: 1;
justify-content: center;
align-items: center;
}
main>.recommend>section:nth-of-type(5){
display: flex;
flex-flow: column nowrap;
}
main>.recommend>section:nth-of-type(5)>div{
display: flex;
background-color: #fff;
margin: 5px;
}
main>.recommend>section:nth-of-type(5)>div>span{
display: flex;
flex: 1;
margin-top: 10px;
padding-left: 10px;
}
main>.recommend>sectiog:nth-of-type(5)>div a:last-child{
display: flex;
flex: 1;
}
main>.recommend>section:nth-of-type(5)>div:last-child>a{
display: flex;
flex: 1;
justify-content: center;
align-items: center;
}
main>.recommend>section:nth-of-type(6){
display: flex;
flex-flow: column nowrap;
}
main>.recommend>section:nth-of-type(6)>div{
display: flex;
background-color: #fff;
margin: 5px;
}
main>.recommend>section:nth-of-type(6)>div>span{
display: flex;
flex: 1;
margin-top: 10px;
padding-left: 10px;
}
main>.recommend>sectiog:nth-of-type(6)>div a:last-child{
display: flex;
flex: 1;
}
main>.recommend>section:nth-of-type(6)>div:last-child>a{
display: flex;
flex: 1;
justify-content: center;
align-items: center;
}
footer>div{
display: flex;
background-color:#edeff0;
}
footer>div>a{
display: flex;
flex: 1;
flex-flow: column nowrap;
align-items: center;
}
footer>div img{
width: 30px;
height: 30px;
}
2/将中间导航菜单区的代码手抄至少一遍,并给每一行代码加上注释
见上:
3/写作业总结
模仿页面前先分析页面布局,页面是由哪些结构组成,页面的结构排列方式,主轴为横轴还是纵轴排列;分析完大框架,逐个写头部/主体/底部框架,再用css样式修饰html内容。写样式时,先写一个通用或原始样式,引入初始样式写案例样式,写样式时针对移动端视口设置最小最大宽度。