博客列表 >CSS应用实战之仿PHP中文网移动端

CSS应用实战之仿PHP中文网移动端

马晓宁
马晓宁原创
2020年04月14日 09:26:35569浏览

仿PHP中文网移动端

代码

  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="static/css/font-icon.css" />
  7. <title>仿PHP中文网移动端</title>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. a {
  14. text-decoration: none;
  15. }
  16. html {
  17. width: 100vw;
  18. height: 100vh;
  19. font-size: 14px;
  20. background-color: lightgray;
  21. }
  22. /* 头部样式 */
  23. header {
  24. width: 100vw;
  25. height: 5vh;
  26. display: flex;
  27. background-color: #3d3737;
  28. justify-content: space-between;
  29. align-items: center;
  30. padding: 0 1vw;
  31. box-sizing: border-box;
  32. color: darkgray;
  33. position: fixed;
  34. top:0;
  35. }
  36. header > a > img {
  37. width: 30px;
  38. vertical-align: middle;
  39. border-radius: 50%;
  40. }
  41. header > a:last-of-type > img {
  42. width: 28vw;
  43. height: 7vh;
  44. }
  45. /* 轮播图 */
  46. .banner img {
  47. width: 100vw;
  48. height: 35vh;
  49. vertical-align: middle;
  50. }
  51. nav {
  52. width: 100vw;
  53. height: 25vh;
  54. display: flex;
  55. flex-flow: row wrap;
  56. margin: auto;
  57. padding: 5px;
  58. justify-content: space-around;
  59. align-items: center;
  60. box-sizing: border-box;
  61. background-color: #fff;
  62. }
  63. nav img {
  64. width: 40px;
  65. }
  66. nav > div {
  67. width: 25%;
  68. display: flex;
  69. flex-flow: column nowrap;
  70. align-items: center;
  71. }
  72. /* 推荐课程 */
  73. .hot-courser {
  74. margin: 5px auto;
  75. display: flex;
  76. flex-flow: column nowrap;
  77. padding-top: 5px;
  78. box-sizing: border-box;
  79. background-color: #fff;
  80. }
  81. .hot-courser > .one {
  82. margin: 0 10px;
  83. display: flex;
  84. flex-flow: row nowrap;
  85. justify-content: space-between;
  86. }
  87. .hot-courser > .one img {
  88. width: 45vw;
  89. height: 15vh;
  90. vertical-align: middle;
  91. }
  92. .hot-courser > .two {
  93. display: flex;
  94. margin: 5px 10px;
  95. flex-flow: row nowrap;
  96. justify-content: flex-start;
  97. background-color: #fff;
  98. }
  99. .hot-courser > .two img {
  100. width: 30vw;
  101. height: 20vw;
  102. vertical-align: middle;
  103. }
  104. .hot-courser > .two > div {
  105. padding: 5px;
  106. display: flex;
  107. flex-flow: column nowrap;
  108. justify-content: space-between;
  109. }
  110. .hot-courser > .two > div > div > span:first-of-type {
  111. border-radius: 25%;
  112. font-size: 1rem;
  113. color: lightgray;
  114. }
  115. .hot-courser > .two > div > div > span:last-of-type {
  116. color: darkgrey;
  117. margin: 5px;
  118. }
  119. .new-courser {
  120. width: 100vw;
  121. }
  122. .new-courser > .courser {
  123. width: 100vw;
  124. height: 20vh;
  125. margin-top: 10px;
  126. display: flex;
  127. flex-flow: row nowrap;
  128. background-color: #fff;
  129. justify-content: space-between;
  130. align-items: center;
  131. }
  132. .new-courser img {
  133. width: 30vw;
  134. height: 120px;
  135. vertical-align: middle;
  136. margin: 5px 10px;
  137. align-self: flex-end;
  138. }
  139. .new-courser > .courser > div {
  140. width: 70vw;
  141. height: 120px;
  142. display: flex;
  143. flex-flow: column nowrap;
  144. justify-content: space-between;
  145. }
  146. .new-courser > .courser > div > :first-child {
  147. font-size: 1.2rem;
  148. color: #473838;
  149. font-weight: bold;
  150. }
  151. .new-courser > .courser > div > :last-child {
  152. display: flex;
  153. justify-content: space-between;
  154. margin-right: 10px;
  155. color: darkgray;
  156. }
  157. .new-courser > .courser > div > :last-child > :first-child {
  158. background-color: #776e6e;
  159. border-radius: 25%;
  160. color: lightgray;
  161. }
  162. /* 最新文章 */
  163. .articles {
  164. width: 100vw;
  165. }
  166. .articles > .article {
  167. width: 100vw;
  168. height: 10vh;
  169. margin-top: 5px;
  170. display: flex;
  171. flex-flow: row nowrap;
  172. background-color: #fff;
  173. justify-content: space-between;
  174. padding: 10px 5px;
  175. }
  176. .articles > .article img {
  177. width: 40vw;
  178. height: 80px;
  179. vertical-align: middle;
  180. }
  181. .articles > .article > div {
  182. height: 80px;
  183. display: flex;
  184. flex-flow: column nowrap;
  185. justify-content: space-evenly;
  186. }
  187. .articles > .article > div > p {
  188. font-size: 1.1rem;
  189. font-weight: 500;
  190. color:#00000f
  191. }
  192. .new-unit2 > a {
  193. width: 100vw;
  194. height: 35px;
  195. padding: 0 10px;
  196. margin-bottom: 15px;
  197. box-sizing: border-box;
  198. background-color: white;
  199. display: flex;
  200. flex-flow: row nowrap;
  201. align-items: center;
  202. justify-content: center;
  203. }
  204. /* 最新博文*/
  205. .course1 >.blog {
  206. width: 100vw;
  207. height: 40px;
  208. padding: 0 10px;
  209. margin-bottom: 15px;
  210. box-sizing: border-box;
  211. background-color: white;
  212. display: flex;
  213. flex-flow: row nowrap;
  214. align-items: center;
  215. justify-content: space-between;
  216. }
  217. .course1 > .blog a:first-of-type {
  218. width: 70vw;
  219. }
  220. .course1 > .blog a {
  221. font-size: 1.2rem;
  222. color: black;
  223. font-weight: 500;
  224. white-space: nowrap;
  225. text-overflow: ellipsis;
  226. overflow: hidden;
  227. }
  228. .mony1 > a {
  229. width: 100vw;
  230. height: 35px;
  231. padding: 0 10px;
  232. margin-bottom: 15px;
  233. box-sizing: border-box;
  234. background-color: white;
  235. display: flex;
  236. flex-flow: row nowrap;
  237. align-items: center;
  238. justify-content: center;
  239. }
  240. body > footer {
  241. color: rgb(22, 3, 110);
  242. background-color: #068d3e;
  243. border-top: 1px solid #ccc;
  244. height: 60px;
  245. position: fixed;
  246. bottom: 0;
  247. width: 100vw;
  248. display: flex;
  249. justify-content: space-around;
  250. }
  251. body > footer > a {
  252. margin-top: 10px;
  253. font-size: 1rem;
  254. display: flex;
  255. flex-flow: column nowrap;
  256. align-items: center;
  257. }
  258. body > footer > a > span:first-of-type {
  259. font-size: 1.8rem;
  260. }
  261. </style>
  262. </head>
  263. <body>
  264. <!-- 页眉 -->
  265. <header>
  266. <a href=""><img src="static/images/user.jpg" alt="" /></a>
  267. <a href=""><img src="static/images/logo.png" alt="" /></a>
  268. <span class="iconfont"></span>
  269. </header>
  270. <!-- 主体 -->
  271. <div class="container">
  272. <!-- 轮播图 -->
  273. <div class="banner">
  274. <a href=""><img src="static/images/11.png" alt="" /></a>
  275. </div>
  276. <!-- 导航区 -->
  277. <nav>
  278. <div>
  279. <a href=""><img src="static/images/html.png" alt="" /></a>
  280. <a href="">HTML/CSS</a>
  281. </div>
  282. <div>
  283. <a href=""><img src="static/images/JavaScript.png" alt="" /></a>
  284. <a href="">JavaScript</a>
  285. </div>
  286. <div>
  287. <a href=""><img src="static/images/code.png" alt="" /></a>
  288. <a href="">服务端</a>
  289. </div>
  290. <div>
  291. <a href=""><img src="static/images/sql.png" alt="" /></a>
  292. <a href="">数据库</a>
  293. </div>
  294. <div>
  295. <a href=""><img src="static/images/app.png" alt="" /></a>
  296. <a href="">移动端</a>
  297. </div>
  298. <div>
  299. <a href=""><img src="static/images/tool2.png" alt="" /></a>
  300. <a href="">工具</a>
  301. </div>
  302. <div>
  303. <a href=""><img src="static/images/manual.png" alt="" /></a>
  304. <a href="">手册</a>
  305. </div>
  306. <div>
  307. <a href=""><img src="static/images/live.png" alt="" /></a>
  308. <a href="">直播</a>
  309. </div>
  310. </nav>
  311. <!-- 推荐课程 -->
  312. <h2>推荐课程</h2>
  313. <div class="hot-courser">
  314. <div class="one">
  315. <a href=""><img src="static/images/1.jpg" alt="" /></a>
  316. <a href=""><img src="static/images/2.jpg" alt="" /></a>
  317. </div>
  318. <div class="two">
  319. <a href=""><img src="static/images/6.png" alt="" /></a>
  320. <div>
  321. <p>CI框架30分钟极速入门</p>
  322. <div><span>中级</span><span>12216次播放</span></div>
  323. </div>
  324. </div>
  325. <div class="two">
  326. <a href=""><img src="static/images/7.png" alt="" /></a>
  327. <div>
  328. <p>CI框架30分钟极速入门</p>
  329. <div><span>中级</span><span>80000次播放</span></div>
  330. </div>
  331. </div>
  332. <div class="two">
  333. <a href=""><img src="static/images/1.jpg" alt="" /></a>
  334. <div>
  335. <p>CI框架30分钟极速入门</p>
  336. <div><span>中级</span><span>13221次播放</span></div>
  337. </div>
  338. </div>
  339. </div>
  340. <!-- 最新更新 -->
  341. <h2>最新更新</h2>
  342. <div class="new-courser">
  343. <div class="courser">
  344. <a href=""><img src="static/images/5.jpg" alt="" /></a>
  345. <div>
  346. <a href=""><span>2019python自学视频</span></a>
  347. <p>
  348. 本课程适合想从零开始学习 Python
  349. 编程语言的开发人员。由浅入深的带你进入
  350. </p>
  351. <div><span>初级</span><span>3285次播放</span></div>
  352. </div>
  353. </div>
  354. <div class="courser">
  355. <a href=""><img src="static/images/12.png" alt="" /></a>
  356. <div>
  357. <a href=""><span>PHP开发免费公益直播课</span></a>
  358. <p>
  359. 主讲:php中文网-朱老师( Peter Zhu) 时间:2019.10.17 晚 20:00-22:00
  360. 主题:如何高效的学习一门新技术?
  361. </p>
  362. <div><span>初级</span><span>34444次播放</span></div>
  363. </div>
  364. </div>
  365. <div class="courser">
  366. <a href=""><img src="static/images/12.png" alt="" /></a>
  367. <div>
  368. <a href=""><span>PHP开发免费公益直播课</span></a>
  369. <p>
  370. 主讲:php中文网-朱老师( Peter Zhu) 时间:2019.10.17 晚 20:00-22:00
  371. 主题:如何高效的学习一门新技术?
  372. </p>
  373. <div><span>初级</span><span>36167次播放</span></div>
  374. </div>
  375. </div>
  376. <div class="courser">
  377. <a href=""><img src="static/images/12.png" alt="" /></a>
  378. <div>
  379. <a href=""><span>PHP开发免费公益直播课</span></a>
  380. <p>
  381. 主讲:php中文网-朱老师( Peter Zhu) 时间:2019.10.17 晚 20:00-22:00
  382. 主题:如何高效的学习一门新技术?
  383. </p>
  384. <div><span>初级</span><span>48997次播放</span></div>
  385. </div>
  386. </div>
  387. <div class="courser">
  388. <a href=""><img src="static/images/12.png" alt="" /></a>
  389. <div>
  390. <a href=""><span>PHP开发免费公益直播课</span></a>
  391. <p>
  392. 主讲:php中文网-朱老师( Peter Zhu) 时间:2019.10.17 晚 20:00-22:00
  393. 主题:如何高效的学习一门新技术?
  394. </p>
  395. <div><span>初级</span><span>66167次播放</span></div>
  396. </div>
  397. </div>
  398. </div>
  399. <!-- 最新文章 -->
  400. <h2>最新文章</h2>
  401. <div class="articles">
  402. <div class="article">
  403. <div>
  404. <p>为什么我的电脑只有C盘</p>
  405. <span>发布时间:<time>2020-04-10</time></span>
  406. </div>
  407. <a href=""><img src="static/images/13.jpg" alt="" /></a>
  408. </div>
  409. <div class="article">
  410. <div>
  411. <p>为什么我的电脑只有C盘</p>
  412. <span>发布时间:<time>2020-04-1</time></span>
  413. </div>
  414. <a href=""><img src="static/images/13.jpg" alt="" /></a>
  415. </div>
  416. <div class="article">
  417. <div>
  418. <p>为什么我的电脑只有C盘</p>
  419. <span>发布时间:<time>2020-03-12</time></span>
  420. </div>
  421. <a href=""><img src="static/images/13.jpg" alt="" /></a>
  422. </div>
  423. </div>
  424. </div>
  425. </div>
  426. <div class="bgcolor">
  427. <h2>最新博文</h2>
  428. <div class="course1">
  429. <div class="blog">
  430. <a href="">thinkphp5.6源码阅读</a>
  431. <a href="">2020-4-11</a>
  432. </div>
  433. <div class="blog">
  434. <a href="">thinkphp5.6源码阅读</a>
  435. <a href="">2020-4-11</a>
  436. </div>
  437. <div class="blog">
  438. <a href="">thinkphp5.6源码阅读</a>
  439. <a href="">2020-4-11</a>
  440. </div>
  441. <div class="blog">
  442. <a href="">thinkphp5.6源码阅读</a>
  443. <a href="">2020-4-11</a>
  444. </div>
  445. <div class="blog">
  446. <a href="">thinkphp5.6源码阅读</a>
  447. <a href="">2020-4-11</a>
  448. </div>
  449. <div class="mony">
  450. <div class="mony1">
  451. <a href="">更多内容</a>
  452. </div>
  453. </div>
  454. </div>
  455. </div>
  456. <div class="mony">
  457. <div class="mony1">
  458. <a href="">更多内容</a>
  459. </div>
  460. </div>
  461. <!-- 底部 -->
  462. <footer>
  463. <a href="">
  464. <span class="iconfont"></span>
  465. <span>首页</span>
  466. </a>
  467. <a href="">
  468. <span class="iconfont"></span>
  469. <span>视频</span>
  470. </a>
  471. <a href="">
  472. <span class="iconfont"></span>
  473. <span>设置</span>
  474. </a>
  475. <a href="">
  476. <span class="iconfont"></span>
  477. <span>我的</span>
  478. </a>
  479. </footer>
  480. </body>
  481. </html>

效果图


总结:

最初的时候,我很茫然,因为刚接触陌生的东西心里会很害怕跟不上老师的进程。刚开始几节课,老师讲得比较基础,还能跟得上,渐渐的老师授课的进程开始加速,有些跟不上了,需要下课后自己再巩固。这次老师布置的第一个综合任务,要求做一个仿PHP中文网移动端的界面。这次也花了整天近三天时间,还是知识了解运用的不够,毕竟是第一次接触,但收获也挺多的,还需要自己多加强练习才能很好的掌握。

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