博客列表 >仿写PHP中文网(第九章 1107作业)-PHP培训九期线上班

仿写PHP中文网(第九章 1107作业)-PHP培训九期线上班

yany
yany原创
2019年12月26日 21:29:49616浏览

1/将PHP中文网移动端剩余部分的内容写完
demo2.html

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>仿PHP中文网手机版首页</title>
  6. <link rel="stylesheet" href="css/style2.css">
  7. </head>
  8. <body>
  9. <header>
  10. <img src="css/images/user-pic.jpeg" alt="">
  11. <img src="css/images/logo.png" alt="">
  12. <img src="css/images/user-nav.jpg" alt="">
  13. </header>
  14. <div class="banner">
  15. <img src="css/images/banner.jpg">
  16. </div>
  17. <nav> /*设置一个导航*/
  18. <ul> /*第一排导航*/
  19. <li>
  20. <a href="">
  21. <img src="css/images/html.png" alt=""> /*图片链接*/
  22. <span>HTML/CSS</span> /*图片对应的名称*/
  23. </a>
  24. </li>
  25. <li>
  26. <a href="">
  27. <img src="css/images/JavaScript.png" alt="">
  28. <span>JavaScript</span>
  29. </a>
  30. </li>
  31. <li>
  32. <a href="">
  33. <img src="css/images/code.png" alt="">
  34. <span>服务端</span>
  35. </a>
  36. </li>
  37. <li>
  38. <a href="">
  39. <img src="css/images/sql.png" alt="">
  40. <span>数据库</span>
  41. </a>
  42. </li>
  43. </ul>
  44. <ul>
  45. <li>
  46. <a href="">
  47. <img src="css/images/app.png" alt="">
  48. <span>移动端</span>
  49. </a>
  50. </li>
  51. <li>
  52. <a href="">
  53. <img src="css/images/manual.png" alt="">
  54. <span>手册</span>
  55. </a>
  56. </li>
  57. <li>
  58. <a href="">
  59. <img src="css/images/tool2.png" alt="">
  60. <span>工具</span>
  61. </a>
  62. </li>
  63. <li>
  64. <a href="">
  65. <img src="css/images/live.png" alt="">
  66. <span>直播</span>
  67. </a>
  68. </li>
  69. </ul>
  70. </nav>
  71. <main>
  72. <div class="recommend">
  73. <h3>推荐课程</h3>
  74. <section>
  75. <a href=""><img src="css/images/tjkc1.jpg" alt=""></a>
  76. <a href=""><img src="css/images/tjkc2.jpg" alt=""></a>
  77. </section>
  78. <section>
  79. <div>
  80. <a href=""><img src="css/images/tjkc3.jpg" alt=""></a>
  81. <span>
  82. <a href="">C框架30分钟极速入门</a>
  83. <span><i>中级</i>52972次播放</span>
  84. </span>
  85. </div>
  86. <div>
  87. <a href=""><img src="css/images/tjkc4.jpg" alt=""></a>
  88. <span>
  89. <a href="">2018前端入门_HTML5</a>
  90. <span><i>初级</i>256398次播放</span>
  91. </span>
  92. </div>
  93. </section>
  94. <h3>最新更新</h3>
  95. <section>
  96. <div>
  97. <a href=""><img src="css/images/zxgx1.jpg" alt=""></a>
  98. <span>
  99. <a href="">2019pytho自学视频</a>
  100. <span>本课程适合想从零开始学习python编程语言的开发人员。由浅入深的带...</span>
  101. <span><i>初级</i>11941次播放</span>
  102. </span>
  103. </div>
  104. <div>
  105. <a href=""><img src="css/images/zxgx2.png" alt=""></a>
  106. <span>
  107. <a href="">PHP开发免费公益直播课</a>
  108. <span>主讲:php中文网-朱老师(Peter Zhu)时间:2019.10.17 晚 20:00-22:00...</span>
  109. <span><i>初级</i>3634次播放</span>
  110. </span>
  111. </div>
  112. <div>
  113. <a href=""><img src="css/images/zxgx3.jpg" alt=""></a>
  114. <span>
  115. <a href="">从零开始到WEB响应式布局</a>
  116. <span>重点介绍了HTML/CSS/web布局前段核心技术,通过视频讲解,了解...</span>
  117. <span><i>初级</i>11206次播放</span>
  118. </span>
  119. </div>
  120. <div>
  121. <a href=""><img src="css/images/zxgx4.png" alt=""></a>
  122. <span>
  123. <a href="">PHP文件基础操作</a>
  124. <span>好多同学在PHP基础的时候对PHP文件的操作了解的不够多,本节课就带...</span>
  125. <span><i>中级</i>4179次播放</span>
  126. </span>
  127. </div>
  128. <div>
  129. <a href=""><img src="css/images/zxgx5.jpg" alt=""></a>
  130. <span>
  131. <a href="">memcache基础课程</a>
  132. <span>本课程带你从零认识memcache,让你在一小时左后轻松掌握memcache...</span>
  133. <span><i>初级</i>1794次播放</span>
  134. </span>
  135. </div>
  136. <div>
  137. <a href=""><img src="css/images/zxgx6.png" alt=""></a>
  138. <span>
  139. <a href="">微信小程序--企业微网站</a>
  140. <span>1,介绍小程序/开发者工具 2,介绍小程序文档 3,微官网项目 4,首页...</span>
  141. <span><i>初级</i>7997次播放</span>
  142. </span>
  143. </div>
  144. </section>
  145. <h3>最新文章</h3>
  146. <section>
  147. <div>
  148. <span>
  149. <a href="">linux的mysql配置文件在哪</a>
  150. <a href="">发布时间:2019-12-26</a>
  151. </span>
  152. <a href=""><img src="css/images/zxwz1.png" alt=""></a>
  153. </div>
  154. <div>
  155. <span>
  156. <a href="">linux命令行中如何同时执行多个命令</a>
  157. <a href="">发布时间:2019-12-26</a>
  158. </span>
  159. <a href=""><img src="css/images/zxwz2.jpg" alt=""></a>
  160. </div>
  161. <div>
  162. <span>
  163. <a href="">phpmyadmin需要付费吗</a>
  164. <a href="">发布时间:2019-12-26</a>
  165. </span>
  166. <a href=""><img src="css/images/zxwz3.jpg" alt=""></a>
  167. </div>
  168. <div>
  169. <span>
  170. <a href="">Nginx缓存使用</a>
  171. <a href="">发布时间:2019-12-26</a>
  172. </span>
  173. <a href=""><img src="css/images/zxwz4.jpg" alt=""></a>
  174. </div>
  175. <div>
  176. <span>
  177. <a href="">PHP文字生成透明图片之路</a>
  178. <a href="">发布时间:2019-12-26</a>
  179. </span>
  180. <a href=""><img src="css/images/zxwz5.jpg" alt=""></a>
  181. </div>
  182. <div>
  183. <a href="">更多内容</a>
  184. </div>
  185. </section>
  186. <h3>最新博文</h3>
  187. <section>
  188. <div>
  189. <span>
  190. <a href="">转载《PHP安全之道》学习笔记1:PHP项目安全设置</a>
  191. <a href="">2019-12-25</a>
  192. </span>
  193. </div>
  194. <div>
  195. <span>
  196. <a href="">关于双列排版自适应问题:(左侧固定,右侧自适应)成功,(右侧...</a>
  197. <a href="">2019-12-24</a>
  198. </span>
  199. </div>
  200. <div>
  201. <a href="">更多内容</a>
  202. </div>
  203. </section>
  204. <h3>最新问答</h3>
  205. <section>
  206. <div>
  207. <span>
  208. <a href="">echo是遍历所有元素的对象</a>
  209. <a href="">2019-12-25</a>
  210. </span>
  211. </div>
  212. <div>
  213. <span>
  214. <a href="">关于tp5.0向小程序返回json格式数据异常问题</a>
  215. <a href="">2019-12-25</a>
  216. </span>
  217. </div>
  218. <div>
  219. <span>
  220. <a href="">想看以前的课程怎么办,</a>
  221. <a href="">2019-12-25</a>
  222. </span>
  223. </div>
  224. <div>
  225. <span>
  226. <a href="">hr样式</a>
  227. <a href="">2019-12-25</a>
  228. </span>
  229. </div>
  230. <div>
  231. <span>
  232. <a href="">谁能告诉我php7+tp5.1时遇到使用session::set()问题</a>
  233. <a href="">2019-12-24</a>
  234. </span>
  235. </div>
  236. <div>
  237. <a href="">更多内容</a>
  238. </div>
  239. </section>
  240. </div>
  241. </main>
  242. <footer>
  243. <div>
  244. <a href=""><img src="css/font-icon/zhuye.png">首页</a>
  245. <a href=""><img src="css/font-icon/video.png">视频</a>
  246. <a href=""><img src="css/font-icon/luntan.png">社区</a>
  247. <a href=""><img src="css/font-icon/geren.png">我的</a>
  248. </div>
  249. </footer>
  250. </body>
  251. </html>

init.css

  1. body,footer{
  2. min-width: 320px;
  3. max-width: 768px;
  4. margin: 0 auto;
  5. background-color: #edeff0;
  6. overflow-y: initial;
  7. position: relative;
  8. color: gray;
  9. overflow: hidden;
  10. -webkit-tap-highlight-color: transparent;
  11. }
  12. img{
  13. width: 100%;
  14. }
  15. ul,li{
  16. margin: 0;
  17. padding: 0;
  18. }
  19. li{
  20. list-style: none;
  21. }
  22. a{
  23. text-decoration: none;
  24. color: gray;
  25. }

style2.css

  1. @import"init.css";
  2. header{
  3. position: fixed;
  4. top:0;
  5. width: 100%;
  6. height: 42px;
  7. background-color: #444444;
  8. color: white;
  9. min-width: 320px;
  10. max-width: 768px;
  11. display: flex;
  12. justify-content: space-between;
  13. align-items: center;
  14. }
  15. header>img:first-of-type,
  16. header>img:last-of-type{
  17. width: 26px;
  18. height: 26px;
  19. margin: 5px;
  20. }
  21. header>img:first-of-type{
  22. border-radius: 50%;
  23. }
  24. header>img{
  25. width: 94px;
  26. }
  27. .banner{
  28. display: flex;
  29. height: 200px;
  30. }
  31. nav{
  32. background-color: #fff; /*为导航设置背景色*/
  33. display: flex;
  34. flex-flow: column nowrap; /*导航纵向排列,不换行*/
  35. }
  36. nav img{ /*设置图标大小*/
  37. width: 45px;
  38. height: 49px;
  39. }
  40. nav>ul{
  41. display: flex;
  42. }
  43. nav ul li {
  44. flex: 1;
  45. }
  46. nav ul li a{ /*设置a标签样式*/
  47. display: flex;
  48. flex-flow: column wrap;
  49. align-items: center; /*设置导航与纵轴排列样式*/
  50. margin: 10px;
  51. }
  52. nav ul li a span{
  53. margin-top: 5px;
  54. }
  55. main{
  56. display: flex;
  57. flex-flow: column nowrap;
  58. }
  59. main>.recommend>section:first-of-type{
  60. display: flex;
  61. }
  62. main>.recommend>section:first-of-type>a{
  63. margin: 5px;
  64. flex: 1;
  65. }
  66. main>.recommend>section:first-of-type>a>img{
  67. height: 90px;
  68. }
  69. main>.recommend>section:nth-of-type(2){
  70. display: flex;
  71. flex-flow: column nowrap;
  72. }
  73. main>.recommend>section:nth-of-type(2)>div{
  74. background-color: #fff;
  75. margin: 5px;
  76. display: flex;
  77. }
  78. main>.recommend>section:nth-of-type(2)>div img{
  79. width: 350px;
  80. height: 90px;
  81. }
  82. main>.recommend>section:nth-of-type(2)>div>span{
  83. display: flex;
  84. flex-flow: column nowrap;
  85. margin-top: 5px;
  86. padding-left: 10px;
  87. }
  88. main>.recommend>section:nth-of-type(2)>div>span i{
  89. font-style: normal;
  90. background-color: #333333;
  91. color: white;
  92. border-radius: 4px;
  93. padding: 0 5px;
  94. font-size: smaller;
  95. }
  96. main>.recommend>section:nth-of-type(3){
  97. display: flex;
  98. flex-flow: column nowrap;
  99. }
  100. main>.recommend>section:nth-of-type(3)>div{
  101. display: flex;
  102. background-color: #fff;
  103. margin: 5px;
  104. }
  105. main>.recommend>section:nth-of-type(3)>div img{
  106. width: 350px;
  107. height: 90px;
  108. }
  109. main>.recommend>section:nth-of-type(3)>div>span{
  110. display: flex;
  111. flex-flow: column nowrap;
  112. margin-top: 5px;
  113. padding-left: 10px;
  114. }
  115. main>.recommend>section:nth-of-type(3)>div>span i{
  116. font-style: normal;
  117. background-color: #333333;
  118. color: white;
  119. border-radius: 4px;
  120. padding:0 5px;
  121. font-size: smaller;
  122. }
  123. main>.recommend>section:nth-of-type(4){
  124. display: flex;
  125. flex-flow: column nowrap;
  126. }
  127. main>.recommend>section:nth-of-type(4)>div{
  128. display: flex;
  129. background-color: #fff;
  130. margin: 5px;
  131. }
  132. main>.recommend>section:nth-of-type(4)>div img{
  133. width: 200px;
  134. height: 90px;
  135. float: right;
  136. }
  137. main>.recommend>section:nth-of-type(4)>div>span{
  138. display: flex;
  139. flex: 1;
  140. flex-flow: column nowrap;
  141. margin-top: 10px;
  142. padding-left: 10px;
  143. }
  144. main>.recommend>section:nth-of-type(4)>div:last-child>a{
  145. display: flex;
  146. flex: 1;
  147. justify-content: center;
  148. align-items: center;
  149. }
  150. main>.recommend>section:nth-of-type(5){
  151. display: flex;
  152. flex-flow: column nowrap;
  153. }
  154. main>.recommend>section:nth-of-type(5)>div{
  155. display: flex;
  156. background-color: #fff;
  157. margin: 5px;
  158. }
  159. main>.recommend>section:nth-of-type(5)>div>span{
  160. display: flex;
  161. flex: 1;
  162. margin-top: 10px;
  163. padding-left: 10px;
  164. }
  165. main>.recommend>sectiog:nth-of-type(5)>div a:last-child{
  166. display: flex;
  167. flex: 1;
  168. }
  169. main>.recommend>section:nth-of-type(5)>div:last-child>a{
  170. display: flex;
  171. flex: 1;
  172. justify-content: center;
  173. align-items: center;
  174. }
  175. main>.recommend>section:nth-of-type(6){
  176. display: flex;
  177. flex-flow: column nowrap;
  178. }
  179. main>.recommend>section:nth-of-type(6)>div{
  180. display: flex;
  181. background-color: #fff;
  182. margin: 5px;
  183. }
  184. main>.recommend>section:nth-of-type(6)>div>span{
  185. display: flex;
  186. flex: 1;
  187. margin-top: 10px;
  188. padding-left: 10px;
  189. }
  190. main>.recommend>sectiog:nth-of-type(6)>div a:last-child{
  191. display: flex;
  192. flex: 1;
  193. }
  194. main>.recommend>section:nth-of-type(6)>div:last-child>a{
  195. display: flex;
  196. flex: 1;
  197. justify-content: center;
  198. align-items: center;
  199. }
  200. footer>div{
  201. display: flex;
  202. background-color:#edeff0;
  203. }
  204. footer>div>a{
  205. display: flex;
  206. flex: 1;
  207. flex-flow: column nowrap;
  208. align-items: center;
  209. }
  210. footer>div img{
  211. width: 30px;
  212. height: 30px;
  213. }

2/将中间导航菜单区的代码手抄至少一遍,并给每一行代码加上注释
见上:

3/写作业总结
模仿页面前先分析页面布局,页面是由哪些结构组成,页面的结构排列方式,主轴为横轴还是纵轴排列;分析完大框架,逐个写头部/主体/底部框架,再用css样式修饰html内容。写样式时,先写一个通用或原始样式,引入初始样式写案例样式,写样式时针对移动端视口设置最小最大宽度。

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议