1、效果展示
http://192.144.155.203:90/0410/fphp/index.html
2、原代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>仿PHP中文网移动端</title>
<style>
@import 'static/css/font.css';
*{
margin: 0px;
padding: 0px;
}
body{
width: 100vw;
background-color: #dcdddd;
display: flex;
flex-flow: column nowrap;
box-sizing: border-box;
}
body >header{
width: 100vw;
height: 3.5rem;
padding: 10px;
background-color: lightslategray;
color: white;
display: flex;
position: fixed;
top:0;
box-sizing: border-box;
}
body > header > a{
text-decoration: none;
color: white;
width: 100vw;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
}
body >header>a>span:nth-of-type(2)>img{
height: 8vw;
}
body >header>a:hover>span:last-of-type{
color: sienna;
}
body> .solider>a>img{
width: 100vw;
}
body> .solider{
margin-top:4vw;
}
body>.nav{
background-color:white;
width: 100vw;
margin-top: 0.8vw;
display: flex;
flex-flow: column nowrap;
align-content: space-around;
justify-content: center;
box-sizing: border-box;
}
body>.nav>.one,body>.nav>.two{
font-size: 2.5vw;
padding: 3vw;
display: flex;
flex-flow: row nowrap;
justify-content: space-around;
align-content: center;
}
body>.nav>.one>a,body>.nav>.two>a{
text-decoration: none;
color:grey;
display: flex;
flex-flow: column nowrap;
align-items: center;
}
body>.nav>.one>a>span>img,body>.nav>.two>a>span>img{
height: 11vw;
}
body>.nav>.one>a>span:last-of-type,body>.nav>.two>a>span:last-of-type{
margin-top: 1vw;
}
body>.nav>.one>a>span:first-of-type,body>.nav>.two>a>span:first-of-type{
background-color: lightseagreen;
border-radius:3vw ;
padding: -2vw 0vw;
height: 10vw;
}
body>.nav>.one>a:nth-of-type(2)>span:first-of-type{
background-color: tomato;
}
body>.nav>.one>a:nth-of-type(3)>span:first-of-type{
background-color: rgb(53, 223, 129);
}
body>.nav>.one>a:last-of-type>span:first-of-type{
background-color: rgb(179, 99, 136);
}
body>.nav>.two>a:first-of-type>span:first-of-type{
background-color: rgb(235, 127, 65);
}
body>.nav>.two>a:nth-of-type(2)>span:first-of-type{
background-color: rgb(38, 143, 192);
}
body>.nav>.two>a:nth-of-type(3)>span:first-of-type{
background-color: rgb(56, 143, 30);
}
body>.nav>.two>a:last-of-type>span:first-of-type{
background-color: rgb(255, 116, 123);
}
body>h3{
margin: 6vw 2vw 2vw 2vw;
color: #7d7d7d;
}
body>.tj1{
display: flex;
box-sizing: border-box;
}
body>.tj1>a{
width: 100vw;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
box-sizing: border-box;
}
body>.tj1>a>img{
width: 49vw;
height: 24vw;
} body>.tj2>.t>a>img,body>.gx>.t>a>img,body>.wz>.t>a>img{
width: 41vw;
height: 20vw;
}
body>.tj2,body>.gx,body>.wz{
width: 100vw;
display: flex;
flex-flow:column nowrap;
align-content: center;
}
body>.tj2>.t,body>.gx>.t{
margin-top: 2vw;
background-color: white;
height: 22vw;
padding-left: 2vw;
padding-top: 2vw;
display: flex;
flex-flow:row nowrap;
align-items: flex-start;
}
body>.tj2>.t>div,body>.gx>.t>div,body>.wz>.t>div{
padding-left: 3vw;
display: flex;
flex-flow: column nowrap;
justify-content:space-around;
}
body>.tj2>.t>div>a,body>.gx>.t>div>a,body>.wz>.t>div>a{
text-decoration: none;
color: #7d7d7d;
font-size: 3vw;
}
body>.tj2>.t>div>p{
padding-top: 2vw;
font-size: 2.5vw;
color: #7d7d7d;
display: flex;
flex-flow: row nowrap;
justify-content:flex-start
}
body>.tj2>.t>div>p>span:first-of-type,body>.gx>.t>div>p>span:first-of-type{
background-color: gray;
color:white;
border-radius: 2vw;
margin-right: 1vw;
}
body>.gx>.t>div>p{
padding-top: 2vw;
font-size: 2.5vw;
color: #7d7d7d;
}
body>.gx>.t>div>p:last-of-type{
margin-right: 5vw;
display: flex;
flex-flow: row nowrap;
justify-content:space-between
}
body>.wz>.t>div>span{
font-size: 2.5vw;
color: #7d7d7d;
margin-top: 2vw;
}
body>.wz>.t>div{
margin-right: 3vw ;
}
body>.wz>.t{
margin-top: 2vw;
background-color: white;
height: 22vw;
padding-left: 2vw;
padding-top: 2vw;
display: flex;
flex-flow:row nowrap;
align-items: flex-start;
justify-content: space-between;
}
body>.bw,body>.wd{
width: 100vw;
display: flex;
flex-flow: column nowrap;
justify-content: flex-start;
}
body>.bw>a,body>.wd>a{
background-color: white;
width: 100vw;
margin-top: 2vw;
text-decoration: none;
padding: 3vw;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
box-sizing: border-box;
}
body>.bw>a:first-of-type,body>.wd>a:first-of-type{
margin-top: 0vw;
}
body>.bw>a>span:first-of-type,body>.wd>a>span:first-of-type{
font-size: 3vw;
color: #7d7d7d;
}
body>.bw>a>span:last-of-type,body>.wd>a>span:last-of-type{
font-size: 2.5vw;
color: #7d7d7d;
}
body>footer{
width: 100vw;
padding: 2vw;
height: 3.5rem;
background-color:#afafb0;
border-top: 0.3vw solid #afafb0;
color: white;
display: flex;
flex-flow: row nowrap;
justify-content:space-around;
box-sizing: border-box;
position: fixed;
bottom:0;
}
body>footer>a{
margin-top: -2vw;
text-decoration: none;
color: white;
display: flex;
flex-flow: column nowrap;
align-content: center;
}
body>footer>a:hover{
color: lightsalmon;
}
body>footer>a:visited:first-of-type{
color: lightsalmon;
}
</style>
</head>
<body>
<header>
<a href="">
<span class="iconfont"></span>
<span><img src="static/images/logo.png"> </span>
<span class="iconfont"></span>
</a>
</header>
<div class="solider">
<a href="">
<img src="static/images/1.jpg">
</a>
</div>
<div class="nav">
<div class="one">
<a href="">
<span><img src="static/images/code.png"></span>
<span>HTML/CSS</span>
</a>
<a href="">
<span><img src="static/images/code.png"></span>
<span>JavaScript</span>
</a>
<a href="">
<span><img src="static/images/ali-clould.png"></span>
<span>服务端</span>
</a>
<a href="">
<span><img src="static/images/integral.png"></span>
<span>数据库</span>
</a>
</div>
<div class="two">
<a href="">
<span><img src="static/images/mobile-phone.png"></span>
<span>移动端</span>
</a>
<a href="">
<span><img src="static/images/template.png"></span>
<span>手册</span>
</a>
<a href="">
<span><img src="static/images/tool.png"></span>
<span>工具</span>
</a>
<a href="">
<span><img src="static/images/robot.png"></span>
<span>直播</span>
</a>
</div>
</div>
<h3>推荐课程</h3>
<div class="tj1">
<a href="">
<img src="static/images/t1.jpg">
<img src="static/images/t2.jpg">
</a>
</div>
<div class="tj2">
<div class="t">
<a href="">
<img src="static/images/t3.jpg">
</a>
<div>
<a href="">CI框架30分钟极速入门</a>
<p>
<span>中级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
<div class="t">
<a href="">
<img src="static/images/t4.jpg">
</a>
<div>
<a href="">2018前端入门_HTML5</a>
<p>
<span>初级</span>
<span>310408次播放</span>
</p>
</div>
</div>
</div>
<h3>最新更新</h3>
<div class="gx">
<div class="t">
<a href="">
<img src="static/images/g1.png">
</a>
<div>
<a href="">PHP快速操控Excel之PhpSpreadsheet</a>
<p>老的PHPExcel已经停止更新了!目前最新...</p>
<p>
<span>中级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
<div class="t">
<a href="">
<img src="static/images/g2.png">
</a>
<div>
<a href="">Thinkphp6.0正式版视频教程</a>
<p>Thinkphp6.0从2019年10月24日正式发布...</p>
<p>
<span>中级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
<div class="t">
<a href="">
<img src="static/images/g3.jpg">
</a>
<div>
<a href="">2019python自学视频</a>
<p>本课程适合想从零开始学习 Python 编程...</p>
<p>
<span>初级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
<div class="t">
<a href="">
<img src="static/images/g4.png">
</a>
<div>
<a href="">PHP开发免费公益直播课</a>
<p>主讲:php中文网-朱老师( Peter Zhu)...</p>
<p>
<span>初级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
<div class="t">
<a href="">
<img src="static/images/g5.png">
</a>
<div>
<a href="">从零开始到WEB响应式布局</a>
<p>重点介绍了HTML、CSS、web布局前端核心...</p>
<p>
<span>初级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
<div class="t">
<a href="">
<img src="static/images/g6.png">
</a>
<div>
<a href="">PHP文件基础操作</a>
<p>好多同学在PHP基础的时候对PHP文件的...</p>
<p>
<span>中级</span>
<span>2565757次播放</span>
</p>
</div>
</div>
</div>
<h3>最新文章</h3>
<div class="wz">
<div class="t">
<div>
<a href="">thinkphp5 + barcode 生成条形码的方法</a>
<span>发布时间:2020-04-12</span>
</div>
<a href="">
<img src="static/images/z1.jpg">
</a>
</div>
<div class="t">
<div>
<a href="">如何使用html+css+js实现3D相册</a>
<span>发布时间:2020-04-12</span>
</div>
<a href="">
<img src="static/images/z2.png">
</a>
</div>
<div class="t">
<div>
<a href="">Laravel 之 广播 模块详解</a>
<span>发布时间:2020-04-12</span>
</div>
<a href="">
<img src="static/images/z3.jpg">
</a>
</div>
<div class="t">
<div>
<a href="">mysql中key 、primary key 、unique ...</a>
<span>发布时间:2020-04-12</span>
</div>
<a href="">
<img src="static/images/z4.png">
</a>
</div>
<div class="t">
<div>
<a href="">升级后的phpmyadmin 打不开怎么办</a>
<span>发布时间:2020-04-12
</span>
</div>
<a href>
<img src="static/images/z5.jpg">
</a>
</div>
</div>
<div style="margin: 3vw 0vw 0vw 0vw;width:100vw;box-sizing: border-box;background-color: white;width: 100vw;text-align: center;padding: 2vw;"><a href="" style="text-decoration: none;color:#7d7d7d;">更多内容</a></div>
<h3>最新博文</h3>
<div class="bw">
<a href="">
<span>CSS3:弹性盒子flex布局</span>
<span>2020-04-12</span>
</a>
<a href="">
<span>Jquery+AJAX上传文件,无刷新上传并重命名文件</span>
<span>2020-04-11</span>
</a>
<a href="">
<span>thinkphp5.6源码阅读1</span>
<span>2020-04-11</span>
</a>
<a href="">
<span>Composer windows安装详细介绍</span>
<span>2020-04-10</span>
</a>
<a href="">
<span>AI智能电销机器人源码 源码解读(1)—基础</span>
<span>2020-04-10</span>
</a>
</div>
<div style="margin: 3vw 0vw 0vw 0vw;width:100vw;box-sizing: border-box;background-color: white;width: 100vw;text-align: center;padding: 2vw;"><a href="" style="text-decoration: none;color:#7d7d7d;">更多内容</a></div>
<h3>最新问答</h3>
<div class="wd">
<a href="">
<span>url访问admin下的控制器的方法,有问题</span>
<span>2020-04-12</span>
</a>
<a href="">
<span>php+workerman实现新订单提示语音</span>
<span>2020-04-12</span>
</a>
<a href="">
<span>不出现tp6.0页面</span>
<span>2020-04-12</span>
</a>
<a href="">
<span>数据库密码··</span>
<span>2020-04-12</span>
</a>
<a href="">
<span>制定的学习计划在哪能找到 咋找不到呢?</span>
<span>2020-04-10</span>
</a>
</div>
<div style="margin: 3vw 0vw 20vw 0vw;width:100vw;box-sizing: border-box;background-color: white;width: 100vw;text-align: center;padding: 2vw;"><a href="" style="text-decoration: none;color:#7d7d7d;">更多内容</a></div>
<footer>
<a href="" >
<span class="iconfont"></span>
<span>首页</span>
</a>
<a href="">
<span class="iconfont"></span>
<span>视频</span>
</a>
<a href="">
<span class="iconfont"></span>
<span>社区</span>
</a>
<a href="">
<span class="iconfont"></span>
<span>我的</span>
</a>
</footer>
</body>
</html>
3、学习总结
本节课我们进行了一个小的仿站实战课,是对前面知识的一个综合应用,主要运用的知识包括:伪类选择器,flex布局等。通过实战让我感觉到了使用flex布局能够快速的将一个页面框架搭建起来,使用方便,快捷,代码量少。伪类选择器能够快速的定位到自己需要设置标签的标签上,使用起来也很方便。在整个实战结束以后与其他同学的相比较,我的不足之处在于页面的配色上,这个需要提高一下自己的美术功底,以后做出来的页面配色让浏览者看了以后有一种赏心悦目的感觉。