Blogger Information
Blog 26
fans 0
comment 0
visits 18146
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
仿php中文网移动端网页
雪~人胖胖
Original
716 people have browsed it

使用flex布局实现php中文网移动端网页布局

地址http://120.26.174.178:90/0411/demo1.html

  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. <title>Document</title>
  7. <link rel="stylesheet" href="static/css/font-icon.css" />
  8. <style>
  9. /* 初始化设置 */
  10. * {
  11. margin: 0;
  12. padding: 0;
  13. }
  14. a {
  15. text-decoration: none;
  16. color: #666;
  17. }
  18. html {
  19. width: 100vw;
  20. height: 100vh;
  21. font-size: 14px;
  22. }
  23. body {
  24. min-width: 360px;
  25. background-color: #dddddd;
  26. display: flex;
  27. flex-flow: column nowrap;
  28. justify-content: center;
  29. align-items: center;
  30. }
  31. /* 页眉 */
  32. header {
  33. width: 100vw;
  34. height: 5vh;
  35. background-color: #333;
  36. display: flex;
  37. align-items: center;
  38. justify-content: space-between;
  39. color: #fff;
  40. padding: 0px 16px;
  41. position: fixed;
  42. top: 0px;
  43. }
  44. header > img:first-of-type {
  45. margin: 0px 15px;
  46. width: 20px;
  47. border-radius: 16px;
  48. }
  49. header > img:last-of-type {
  50. width: 70px;
  51. }
  52. header > span {
  53. margin-right: 3vw;
  54. }
  55. .slider img {
  56. width: 100vw;
  57. margin-top: 5vh;
  58. }
  59. nav {
  60. display: flex;
  61. flex-flow: row wrap;
  62. background-color: #fff;
  63. }
  64. nav > div {
  65. display: flex;
  66. flex-flow: column nowrap;
  67. width: 25vw;
  68. align-items: center;
  69. margin: 10px 0px;
  70. }
  71. nav > div > a img {
  72. width: 50%;
  73. }
  74. nav > div > a {
  75. text-align: center;
  76. }
  77. h3 {
  78. display: block;
  79. margin-bottom: 10px;
  80. color: #888;
  81. }
  82. /* 双图片 */
  83. .course {
  84. display: flex;
  85. flex-flow: column nowrap;
  86. margin: 30px 0px 30px;
  87. flex: 1 1 auto;
  88. width: 95vw;
  89. }
  90. .img1 {
  91. width: 95vw;
  92. display: flex;
  93. flex-flow: row nowrap;
  94. justify-content: space-between;
  95. margin-bottom: 15px;
  96. }
  97. .course > .img1 > a > img {
  98. width: 46vw;
  99. }
  100. /* 课程 */
  101. .course > div:not(:first-of-type) {
  102. display: flex;
  103. flex-flow: row nowrap;
  104. width: 95vw;
  105. background-color: #fff;
  106. margin-bottom: 20px;
  107. }
  108. .course > div:not(:first-of-type) a {
  109. display: flex;
  110. box-sizing: border-box;
  111. }
  112. .course > div:not(:first-of-type) > a > img {
  113. width: 40vw;
  114. margin: 10px;
  115. }
  116. .course > div:not(:first-of-type) > div {
  117. padding: 10px 0px;
  118. font-size: 1.2rem;
  119. }
  120. .level {
  121. font-size: 12px;
  122. background-color: #333;
  123. border-radius: 7px;
  124. color: #fff;
  125. padding: 3px;
  126. }
  127. .course > div:not(:first-of-type) > div > span:last-of-type {
  128. font-size: 12px;
  129. color: #888;
  130. }
  131. .course > div:not(:first-of-type) > div > a {
  132. margin-bottom: 10px;
  133. }
  134. /* 最新更新 */
  135. .update {
  136. width: 95vw;
  137. }
  138. .update > .update-list {
  139. display: flex;
  140. flex-flow: row nowrap;
  141. font-size: 1.2rem;
  142. align-items: center;
  143. background-color: #fff;
  144. margin-bottom: 20px;
  145. }
  146. .update > .update-list > div {
  147. flex: 1 1 auto;
  148. }
  149. .update > .update-list > a {
  150. display: flex;
  151. box-sizing: border-box;
  152. }
  153. .update > .update-list > a > img {
  154. width: 40vw;
  155. margin: 10px;
  156. height: 84px;
  157. }
  158. .update > .update-list > div > p {
  159. font-size: 12px;
  160. color: #888;
  161. margin-top: 10px;
  162. }
  163. .update > .update-list > div > span:first-of-type {
  164. display: block;
  165. margin-bottom: 10px;
  166. }
  167. .update > .update-list > div > a {
  168. display: block;
  169. }
  170. .update > .update-list > div > p:nth-of-type(2) {
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. line-height: 14px;
  175. margin-right: 15px;
  176. }
  177. /* 最新文章 */
  178. .article {
  179. width: 95vw;
  180. margin-top: 10px;
  181. }
  182. .article > div {
  183. display: flex;
  184. flex-flow: column wrap;
  185. height: 84px;
  186. justify-content: center;
  187. align-content: space-between;
  188. padding: 10px 10px 8px;
  189. background-color: #fff;
  190. margin-bottom: 20px;
  191. }
  192. .article > div > a:last-of-type > img {
  193. height: 65px;
  194. width: 100.5px;
  195. }
  196. .article > div > span {
  197. font-size: 12px;
  198. color: #888;
  199. }
  200. .article > p {
  201. text-align: center;
  202. background-color: #fff;
  203. line-height: 30px;
  204. }
  205. /* 最新博文 */
  206. .blog {
  207. width: 95vw;
  208. margin-top: 10px;
  209. }
  210. .blog > div {
  211. display: flex;
  212. flex-flow: row nowrap;
  213. height: 45px;
  214. background-color: #fff;
  215. margin-bottom: 20px;
  216. padding: 10px 10px 8px;
  217. box-sizing: border-box;
  218. line-height: 19px;
  219. font-size: 10px;
  220. justify-content: space-between;
  221. }
  222. .blog > div > span {
  223. font-size: 12px;
  224. color: #666;
  225. }
  226. .blog > p {
  227. text-align: center;
  228. background: #fff;
  229. line-height: 30px;
  230. }
  231. .question {
  232. width: 95vw;
  233. margin-top: 10px;
  234. margin-bottom: 70px;
  235. }
  236. .question > div {
  237. display: flex;
  238. flex-flow: row nowrap;
  239. height: 45px;
  240. background-color: #fff;
  241. margin-bottom: 20px;
  242. padding: 10px 10px 8px;
  243. box-sizing: border-box;
  244. line-height: 19px;
  245. font-size: 10px;
  246. justify-content: space-between;
  247. }
  248. .question > div > span {
  249. font-size: 12px;
  250. color: #666;
  251. }
  252. .question > p {
  253. text-align: center;
  254. background: #fff;
  255. line-height: 30px;
  256. }
  257. /* 页脚 */
  258. footer {
  259. display: flex;
  260. justify-content: space-around;
  261. height: 50px;
  262. border-top: 1px solid #888;
  263. padding-top: 10px;
  264. position: fixed;
  265. bottom: 0px;
  266. width: 100vw;
  267. background-color: #fff;
  268. }
  269. footer > a {
  270. display: flex;
  271. flex-flow: column nowrap;
  272. align-items: center;
  273. }
  274. </style>
  275. </head>
  276. <body>
  277. <!-- 页眉 -->
  278. <header>
  279. <img src="static/image/user_avatar.jpg" alt="" />
  280. <img src="static/image/logo.png" alt="" />
  281. <span class="iconfont">&#xe61f;</span>
  282. </header>
  283. <!-- 轮播图 -->
  284. <div class="slider"><img src="static/image/3.jpg" alt="" /></div>
  285. <!-- 导航栏 -->
  286. <nav>
  287. <div>
  288. <a href=""><img src="static/image/html.png" alt="" /></a>
  289. <a href="">HTML/CSS</a>
  290. </div>
  291. <div>
  292. <a href=""><img src="static/image/JavaScript.png" alt="" /></a>
  293. <a href="">JavaScript</a>
  294. </div>
  295. <div>
  296. <a href=""><img src="static/image/code.png" alt="" /></a>
  297. <a href="">服务器</a>
  298. </div>
  299. <div>
  300. <a href=""><img src="static/image/sql.png" alt="" /></a>
  301. <a href="">数据库</a>
  302. </div>
  303. <div>
  304. <a href=""><img src="static/image/app.png" alt="" /></a>
  305. <a href="">移动端</a>
  306. </div>
  307. <div>
  308. <a href=""><img src="static/image/manual.png" alt="" /></a>
  309. <a href="">手册</a>
  310. </div>
  311. <div>
  312. <a href=""><img src="static/image/tool2.png" alt="" /></a>
  313. <a href="">工具</a>
  314. </div>
  315. <div>
  316. <a href=""><img src="static/image/live.png" alt="" /></a>
  317. <a href="">直播</a>
  318. </div>
  319. </nav>
  320. <!-- 推荐课程 -->
  321. <div class="course">
  322. <h3>推荐课程</h3>
  323. <div class="img1">
  324. <a href=""><img src="static/image/5d242759adb88970.jpg" alt="" /></a>
  325. <a href=""><img src="static/image/5d2426f409839992.jpg" alt="" /></a>
  326. </div>
  327. <div>
  328. <a href=""><img src="static/image/5d2941e265889366.jpg" alt="" /></a>
  329. <div>
  330. <a href="">CI框架30分钟极速入门</a>
  331. <span class="level">中级</span>
  332. <span>61447次播放</span>
  333. </div>
  334. </div>
  335. <div>
  336. <a href=""><img src="static/image/5aa23f0ded921649.jpg" alt="" /></a>
  337. <div>
  338. <a href="">2018前端入门HTML5</a>
  339. <span class="level">初级</span>
  340. <span>311851次播放</span>
  341. </div>
  342. </div>
  343. </div>
  344. <!-- 最新更新 -->
  345. <div class="update">
  346. <h3>最新更新</h3>
  347. <div class="update-list">
  348. <a href=""><img src="static/image/5e0d6387e45cc764.png" alt="" /></a>
  349. <div>
  350. <a href="">PHP快速操控Excel之...</a>
  351. <p>老的EXCEL已经停止更新了!...</p>
  352. <p><span class="level">中级</span> <span>15604次播放</span></p>
  353. </div>
  354. </div>
  355. <div class="update-list">
  356. <a href=""><img src="static/image/5e0d82773b4fe808.png" alt="" /></a>
  357. <div>
  358. <a href="">Thinkphp正式版视频...</a>
  359. <p>Thinkphp6.0从2019年10月24日...</p>
  360. <p><span class="level">中级</span> <span>15604次播放</span></p>
  361. </div>
  362. </div>
  363. <div class="update-list">
  364. <a href=""><img src="static/image/5db2b53c67bca626.jpg" alt="" /></a>
  365. <div>
  366. <a href="">2019python自学视频...</a>
  367. <p>本课程适合从零开始学习Pytho...</p>
  368. <p><span class="level">初级</span> <span>15604次播放</span></p>
  369. </div>
  370. </div>
  371. <div class="update-list">
  372. <a href=""><img src="static/image/5da7e9b7895ed229.png" alt="" /></a>
  373. <div>
  374. <a href="">PHP开发免费公益直播</a>
  375. <p>主讲:php中文网-朱老师(P...</p>
  376. <p><span class="level">中级</span> <span>15604次播放</span></p>
  377. </div>
  378. </div>
  379. <div class="update-list">
  380. <a href=""><img src="static/image/5da6a50535529903.jpg" alt="" /></a>
  381. <div>
  382. <a href="">从零开始到WEB响应...</a>
  383. <p>重点介绍了HTML、css...</p>
  384. <p><span class="level">中级</span> <span>15604次播放</span></p>
  385. </div>
  386. </div>
  387. <div class="update-list">
  388. <a href=""><img src="static/image/5da51b8ff1224244.png" alt="" /></a>
  389. <div>
  390. <a href="">PHP文件基础操作</a>
  391. <p>好多同学在PHP基础的时候对P...</p>
  392. <p><span class="level">中级</span> <span>15604次播放</span></p>
  393. </div>
  394. </div>
  395. </div>
  396. <!-- 最新文章 -->
  397. <div class="article">
  398. <h3>最新文章</h3>
  399. <div>
  400. <a href=""><h3>golint的简易使用方法</h3></a>
  401. <span>发布时间:2020-04-15</span>
  402. <a href=""><img src="static/image/5e96d958599ba696.jpg" alt="" /></a>
  403. </div>
  404. <div>
  405. <a href=""><h3>golint的简易使用方法</h3></a>
  406. <span>发布时间:2020-04-15</span>
  407. <a href=""><img src="static/image/java.jpg" alt="" /></a>
  408. </div>
  409. <div>
  410. <a href=""><h3>golint的简易使用方法</h3></a>
  411. <span>发布时间:2020-04-15</span>
  412. <a href=""><img src="static/image/5e96c2939d609975.jpg" alt="" /></a>
  413. </div>
  414. <div>
  415. <a href=""><h3>golint的简易使用方法</h3></a>
  416. <span>发布时间:2020-04-15</span>
  417. <a href=""><img src="static/image/5e96bf348260c743.jpg" alt="" /></a>
  418. </div>
  419. <div>
  420. <a href=""><h3>golint的简易使用方法</h3></a>
  421. <span>发布时间:2020-04-15</span>
  422. <a href=""><img src="static/image/5e96bdf7bf922749.jpg" alt="" /></a>
  423. </div>
  424. <p><a href="">更多内容</a></p>
  425. </div>
  426. <!-- 最新博文 -->
  427. <div class="blog">
  428. <h3>最新博文</h3>
  429. <div>
  430. <h2><a href="">Shiro RememberMe1.2.4反序列...</a></h2>
  431. <span>2020-04-15</span>
  432. </div>
  433. <div>
  434. <h2><a href="">200多行代码实现微信公众号网页...</a></h2>
  435. <span>2020-04-15</span>
  436. </div>
  437. <div>
  438. <h2><a href="">PhpStrom安装PHPUnit-9单元测试...</a></h2>
  439. <span>2020-04-15</span>
  440. </div>
  441. <div>
  442. <h2><a href="">微信的openid和unionid</a></h2>
  443. <span>2020-04-15</span>
  444. </div>
  445. <div>
  446. <h2><a href="">JS实现HTML标签转义及反转义</a></h2>
  447. <span>2020-04-15</span>
  448. </div>
  449. <p><a href="">更多内容</a></p>
  450. </div>
  451. <!-- 最新问答 -->
  452. <div class="question">
  453. <h3>最新问答</h3>
  454. <div>
  455. <h2><a href="">请先启动wep服务是什么意思?</a></h2>
  456. <span>2020-04-15</span>
  457. </div>
  458. <div>
  459. <h2><a href="">ATOM官网打不开无法下载</a></h2>
  460. <span>2020-04-15</span>
  461. </div>
  462. <div>
  463. <h2><a href="">想做网站开发</a></h2>
  464. <span>2020-04-15</span>
  465. </div>
  466. <p><a href="">更多内容</a></p>
  467. </div>
  468. <!-- 页脚 -->
  469. <footer>
  470. <a href="">
  471. <span class="iconfont">&#xe60c;</span>
  472. <span>首页</span>
  473. </a>
  474. <a href="">
  475. <span class="iconfont">&#xe60a;</span>
  476. <span>视频</span>
  477. </a>
  478. <a href="">
  479. <span class="iconfont">&#xe675;</span>
  480. <span>社区</span>
  481. </a>
  482. <a href="">
  483. <span class="iconfont">&#xe600;</span>
  484. <span>我的</span>
  485. </a>
  486. </footer>
  487. </body>
  488. </html>

效果图



总结

自己研究了差不多6个小时,发现自己还有很多知识未掌握,需要好好的在梳理几遍知识。

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:越学越觉得自己有许多不了解, 这是好事, 知识短板
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!