博客列表 >仿PHP中文网移动端案例

仿PHP中文网移动端案例

樊天龙的博客
樊天龙的博客原创
2020年04月13日 17:03:40676浏览

仿PHP中文网移动端案例

演示地址:http://www.fantianlong.com/php11/0410/m.php.cn/

1.源代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link rel="stylesheet" href="css/icon-font.css">
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. }
  12. html {
  13. width: 100vw;
  14. height: 100vh;
  15. font-size: 14px;
  16. }
  17. body {
  18. background-color: rgb(238, 239, 240);
  19. }
  20. .container {
  21. display: flex;
  22. flex-flow: column nowrap;
  23. }
  24. a {
  25. text-decoration: none;
  26. }
  27. header {
  28. width: 100vw;
  29. height: 42px;
  30. display: flex;
  31. justify-content: space-between;
  32. align-items: center;
  33. padding: 0 10px;
  34. box-sizing: border-box;
  35. position: fixed;
  36. background-color: rgb(47, 53, 60);
  37. }
  38. .avatar img {
  39. width: 2.2rem;
  40. height: 2.2rem;
  41. border-radius: 50%;
  42. }
  43. .logo img {
  44. height: 3.2rem;
  45. }
  46. .banner img {
  47. margin-top: 40px;
  48. width: 100vw;
  49. }
  50. nav {
  51. height: 210px;
  52. display: flex;
  53. flex-flow: row wrap;
  54. justify-content: space-around;
  55. padding: 10px 0;
  56. box-sizing: border-box;
  57. font-size: 1.2rem;
  58. }
  59. nav a {
  60. color: #888;
  61. font-weight: bold;
  62. }
  63. nav>div {
  64. width: 25%;
  65. display: flex;
  66. flex-flow: column nowrap;
  67. align-items: center;
  68. margin-bottom: 30px;
  69. }
  70. nav img {
  71. width: 4rem;
  72. height: 4rem;
  73. margin-bottom: 5px;
  74. }
  75. .recommend-course {
  76. display: flex;
  77. flex-flow: column nowrap;
  78. }
  79. h2 {
  80. margin-bottom: 20px;
  81. }
  82. .recommend-course>.top {
  83. display: flex;
  84. flex-flow: row nowrap;
  85. justify-content: space-around;
  86. }
  87. .recommend-course>.top img {
  88. width: 48vw;
  89. height: 90px;
  90. }
  91. .bottom>.item {
  92. display: flex;
  93. margin: 10px;
  94. padding: 10px;
  95. background-color: #ffffff;
  96. }
  97. .item img {
  98. width: 48vw;
  99. height: 80px;
  100. margin-right: 10px;
  101. }
  102. .item p {
  103. color: #888;
  104. }
  105. .item p:nth-of-type(1) {
  106. font-size: 1.2rem;
  107. margin-bottom: 10px;
  108. }
  109. .course-info {
  110. display: flex;
  111. flex-flow: column nowrap;
  112. }
  113. .course-info>p:nth-of-type(1) {
  114. width: 220px;
  115. }
  116. .course-info>p:nth-of-type(2) {
  117. width: 250px;
  118. }
  119. .course-info span {
  120. width: 2rem;
  121. height: 2rem;
  122. border-radius: 13px;
  123. padding: 5px;
  124. box-sizing: border-box;
  125. background-color: rgb(89, 87, 87);
  126. color: #ffffff;
  127. }
  128. footer {
  129. display: flex;
  130. flex-flow: row nowrap;
  131. text-align: center;
  132. height: 40px;
  133. border-top: 1px solid #cccccc;
  134. background-color: rgb(236, 236, 236);
  135. }
  136. footer>p {
  137. display: flex;
  138. flex-flow: column nowrap;
  139. width: 25vw;
  140. }
  141. footer>p>a {
  142. color: #888888;
  143. }
  144. </style>
  145. <title>php中文网-教程_手册_视频-免费php在线学习平台</title>
  146. </head>
  147. <body>
  148. <div class="container">
  149. <!-- 头部 -->
  150. <header>
  151. <div class="avatar">
  152. <a href=""><img src="images/avatar.jpg" alt="avatar"></a>
  153. </div>
  154. <div class="logo">
  155. <a href=""><img src="images/logo.png" alt="logo"></a>
  156. </div>
  157. <div class="menu">
  158. <a href=""><i class="iconfont" style="color: #ccc;">&#xe602;</i></a>
  159. </div>
  160. </header>
  161. <!-- banner -->
  162. <div class="banner">
  163. <a href=""><img src="images/banner.png" alt="banner"></a>
  164. </div>
  165. <!-- 导航 -->
  166. <nav>
  167. <div>
  168. <img src="images/html.png" alt="html/css">
  169. <a href="">HTML/CSS</a>
  170. </div>
  171. <div>
  172. <img src="images/javascript.png" alt="JavaScript">
  173. <a href="">JavaScript</a>
  174. </div>
  175. <div>
  176. <img src="images/server.png" alt="server">
  177. <a href="">服务端</a>
  178. </div>
  179. <div>
  180. <img src="images/sql.png" alt="sql">
  181. <a href="">数据库</a>
  182. </div>
  183. <div>
  184. <img src="images/app.png" alt="app">
  185. <a href="">移动端</a>
  186. </div>
  187. <div>
  188. <img src="images/manual.png" alt="manual">
  189. <a href="">手册</a>
  190. </div>
  191. <div>
  192. <img src="images/tool.png" alt="tool">
  193. <a href="">工具</a>
  194. </div>
  195. <div>
  196. <img src="images/live.png" alt="live">
  197. <a href="">直播</a>
  198. </div>
  199. </nav>
  200. <!-- 推荐课程 -->
  201. <div class="recommend-course">
  202. <h2>推荐课程</h2>
  203. <div class="top">
  204. <a href=""><img src="images/tlbb.jpg" alt="tlbb"></a>
  205. <a href=""><img src="images/tlbb.jpg" alt="tlbb"></a>
  206. </div>
  207. <div class="bottom">
  208. <div class="item">
  209. <a href=""><img src="images/ci.jpg" alt="ci"></a>
  210. <div class="course-info">
  211. <p>CI框架30分钟极速入门</p>
  212. <p><span>中级</span>61289次播放</p>
  213. </div>
  214. </div>
  215. <div class="item">
  216. <a href=""><img src="images/ci.jpg" alt="ci"></a>
  217. <div class="course-info">
  218. <p>CI框架30分钟极速入门</p>
  219. <p><span>中级</span>61289次播放</p>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. <!-- 最近更新 -->
  225. <div class="recommend-course">
  226. <h2>最近更新</h2>
  227. <div class="bottom">
  228. <div class="item">
  229. <a href=""><img src="images/ci.jpg" alt="ci"></a>
  230. <div class="course-info">
  231. <p>Thinkphp6.0正式版视频教程</p>
  232. <p>Thinkphp6.0从2019年10月24日正式发</p>
  233. <p><span>中级</span>61289次播放</p>
  234. </div>
  235. </div>
  236. <div class="item">
  237. <a href=""><img src="images/ci.jpg" alt="ci"></a>
  238. <div class="course-info">
  239. <p>CI框架30分钟极速入门</p>
  240. <p><span>中级</span>61289次播放</p>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. <!-- 底部 -->
  246. <footer>
  247. <p>
  248. <a href="">首页</a>
  249. <i class="iconfont">&#xe601;</i>
  250. </p>
  251. <p>
  252. <a href="">视频</a>
  253. <i class="iconfont">&#xe63d;</i>
  254. </p>
  255. <p>
  256. <a href="">社区</a>
  257. <i class="iconfont">&#xe60e;</i>
  258. </p>
  259. <p>
  260. <a href="">我的</a>
  261. <i class="iconfont">&#xe621;</i>
  262. </p>
  263. </footer>
  264. </div>
  265. </body>
  266. </html>

2.效果图

3.总结

  • flex布局还不是很熟练,之前一直搞PC端固定布局的
  • 还需加强练习,在学习后端的时候也不能放松前端布局的练习
  • 基础知识虽然掌握,但是实战还是有些问题
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议