Blogger Information
Blog 29
fans 0
comment 0
visits 27356
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
2020年4月12日作业--flex布局仿php手机端主页
暴宇
Original
577 people have browsed it

flex布局仿php手机端主页
http://211.149.185.34:90/m.php.html

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>m.php.cn</title>
  7. <link rel="stylesheet" href="css/font.css" />
  8. <style>
  9. /* 页面初始化 */
  10. * {
  11. margin: 0;
  12. padding: 0;
  13. }
  14. /* 页面宽高设置为屏幕大小 */
  15. html {
  16. width: 100vw;
  17. height: 100vh;
  18. font-size: 14px;
  19. max-width: 800px;
  20. }
  21. body {
  22. display: flex;
  23. flex-flow: column nowrap;
  24. min-width: 360px;
  25. background-color: #edeff0;
  26. color: #777;
  27. }
  28. /* 头部 */
  29. header {
  30. background-color: #131313;
  31. color: #ffff;
  32. height: 50px;
  33. display: flex;
  34. align-items: center;
  35. justify-content: center;
  36. padding: 5px;
  37. font-size: 2rem;
  38. position: fixed;
  39. top: 0;
  40. width: 100vw;
  41. }
  42. header > span:first-of-type {
  43. margin-left: 10px;
  44. margin-right: auto;
  45. }
  46. header > span:last-of-type {
  47. margin-right: 10px;
  48. margin-left: auto;
  49. }
  50. /* 轮播图 */
  51. .lunboimg {
  52. height: 150px;
  53. }
  54. .lunboimg > img {
  55. width: 100%;
  56. height: 100%;
  57. }
  58. /* 导航 */
  59. nav {
  60. height: 200px;
  61. display: flex;
  62. flex-flow: row wrap;
  63. margin: 10px 0;
  64. background-color: #fff;
  65. /* justify-content: center; */
  66. align-items: center;
  67. }
  68. nav > div {
  69. width: 25%;
  70. display: flex;
  71. flex-flow: column nowrap;
  72. align-items: center;
  73. }
  74. nav > div > a > img {
  75. height: 50px;
  76. }
  77. a {
  78. text-decoration: none;
  79. color: #131313;
  80. }
  81. nav a:hover {
  82. color: red;
  83. font-size: 1.2rem;
  84. }
  85. /* 所有p标签和h2标签里的字体颜色设置 */
  86. p,
  87. h2,
  88. h3 {
  89. color: #777;
  90. }
  91. /* 主体内容区 */
  92. .container {
  93. display: flex;
  94. flex-flow: column nowrap;
  95. width: 100%;
  96. }
  97. /* 上下布局 */
  98. .up-down {
  99. display: flex;
  100. flex-flow: column nowrap;
  101. margin: 0;
  102. padding: 0;
  103. }
  104. /* 左右布局 */
  105. .left-right {
  106. display: flex;
  107. flex-flow: row nowrap;
  108. margin: 0;
  109. padding: 0;
  110. }
  111. /* 高度 */
  112. .h100 {
  113. height: 100px;
  114. }
  115. .h150 {
  116. height: 150px;
  117. }
  118. .h200 {
  119. height: 200px;
  120. }
  121. /* 宽度 */
  122. .w40 {
  123. width: 40%;
  124. }
  125. .w50 {
  126. width: 50%;
  127. }
  128. .w60 {
  129. width: 60%;
  130. }
  131. .w100 {
  132. width: 100%;
  133. }
  134. /* 内边距 */
  135. .p10 {
  136. padding: 10px;
  137. }
  138. .lrp10 {
  139. padding-left: 10px;
  140. padding-right: 10px;
  141. }
  142. .udp10 {
  143. padding-top: 10px;
  144. padding-bottom: 10px;
  145. }
  146. /* 外边距 */
  147. .m10 {
  148. margin: 10px;
  149. }
  150. .lrm10 {
  151. margin-left: 10px;
  152. margin-right: 10px;
  153. }
  154. .udm10 {
  155. margin-top: 10px;
  156. margin-bottom: 10px;
  157. }
  158. /* 背景色 */
  159. .bg {
  160. background-color: #fff;
  161. }
  162. /* 文字超出隐藏并显示... */
  163. .texthidden {
  164. white-space: nowrap;
  165. overflow: hidden;
  166. text-overflow: ellipsis;
  167. }
  168. /* 主轴分散对齐 */
  169. .divaround {
  170. justify-content: space-around;
  171. }
  172. /* 主轴两端对齐 */
  173. .divbetween {
  174. justify-content: space-between;
  175. }
  176. /* 主轴居中对齐 */
  177. .divcenter {
  178. justify-content: center;
  179. }
  180. /* 交叉轴居中 */
  181. .itemcenter {
  182. align-items: center;
  183. }
  184. /* 交叉轴居中 */
  185. .itemend {
  186. align-items: flex-end;
  187. }
  188. .level {
  189. background: #595757;
  190. color: #fff;
  191. border-radius: 10px;
  192. padding: 3px 6px;
  193. font-size: 10px;
  194. }
  195. /* 底部 */
  196. footer {
  197. position: fixed;
  198. bottom: 0;
  199. display: flex;
  200. flex-flow: row nowrap;
  201. justify-content: space-around;
  202. background-color: #edeff0;
  203. height: 50px;
  204. width: 100vw;
  205. align-items: center;
  206. max-width: 800px;
  207. padding: 0;
  208. }
  209. footer > a {
  210. display: flex;
  211. flex-flow: column nowrap;
  212. align-items: center;
  213. box-sizing: border-box;
  214. width: 25%;
  215. padding: 5px;
  216. }
  217. footer .iconfont {
  218. font-size: 17px;
  219. }
  220. footer > a:hover {
  221. background-color: #ff80ff;
  222. }
  223. footer > a:first-of-type {
  224. color: red;
  225. }
  226. </style>
  227. </head>
  228. <body>
  229. <!-- 头部 -->
  230. <header>
  231. <span>LOGN</span>
  232. <img src="img/logo.png" alt="LOGO" />
  233. <span class="iconfont"></span>
  234. </header>
  235. <!-- 轮播图 -->
  236. <div class="lunboimg">
  237. <img src="img/11.png" alt="" />
  238. </div>
  239. <!-- 导航区 -->
  240. <nav>
  241. <div>
  242. <a href="" class="up-down itemcenter">
  243. <img src="img/html.png" alt="" />HTML/CSS
  244. </a>
  245. </div>
  246. <div>
  247. <a href="" class="up-down itemcenter">
  248. <img src="img/JavaScript.png" alt="" />JavaScript
  249. </a>
  250. </div>
  251. <div>
  252. <a href="" class="up-down itemcenter">
  253. <img src="img/code.png" alt="" />服务端
  254. </a>
  255. </div>
  256. <div>
  257. <a href="" class="up-down itemcenter">
  258. <img src="img/sql.png" alt="" />数据库
  259. </a>
  260. </div>
  261. <div>
  262. <a href="" class="up-down itemcenter">
  263. <img src="img/app.png" alt="" />移动端
  264. </a>
  265. </div>
  266. <div>
  267. <a href="" class="up-down itemcenter">
  268. <img src="img/manual.png" alt="" />手册
  269. </a>
  270. </div>
  271. <div>
  272. <a href="" class="up-down itemcenter">
  273. <img src="img/tool2.png" alt="" />工具
  274. </a>
  275. </div>
  276. <div>
  277. <a href="" class="up-down itemcenter">
  278. <img src="img/live.png" alt="" />直播
  279. </a>
  280. </div>
  281. </nav>
  282. <!-- 主体内容区 -->
  283. <div class="up-down lrm10">
  284. <h2>推荐课程</h2>
  285. <div class="up-down">
  286. <div class="left-right udm10">
  287. <a href="" style="margin-right: 5px;" class="w50">
  288. <img src="img/5d242759adb88970.jpg" alt="" class="h150 w100" />
  289. </a>
  290. <a href="" style="margin-left: 5px;" class="w50">
  291. <img src="img/5d2426f409839992.jpg" alt="" class="h150 w100" />
  292. </a>
  293. </div>
  294. <div class="left-right udm10 bg p10">
  295. <img src="img/5d2941e265889366.jpg" alt="" class="h150 w40" />
  296. <div class="up-down lrm10">
  297. <a href=""><h3 style="height: 65px;">CI框架30分钟极速入门</h3></a>
  298. <div class="left-right">
  299. <p><span class="level">中级</span><span>61462次播放</span></p>
  300. </div>
  301. </div>
  302. </div>
  303. <div class="left-right udm10 bg p10">
  304. <img src="img/5d2941e265889366.jpg" alt="" class="h150 w40" />
  305. <div class="up-down lrm10">
  306. <a href=""><h3 style="height: 65px;">CI框架30分钟极速入门</h3></a>
  307. <div class="left-right">
  308. <p><span class="level">中级</span><span>61462次播放</span></p>
  309. </div>
  310. </div>
  311. </div>
  312. </div>
  313. <h2>最新更新</h2>
  314. <div class="up-down">
  315. <div class="left-right bg p10 udm10">
  316. <img src="img/php.png" alt="" class="h150 w40" />
  317. <div class="up-down lrp10 texthidden divaround">
  318. <a href=""
  319. ><h3 class="texthidden">PHP快速操控Excel之PhpSpreadsheet</h3></a
  320. >
  321. <p class="texthidden">
  322. 老的PHPExcel已经停止更新了!目前最新的是使用phpOffice插件PhpSreadsheet
  323. </p>
  324. <div class="left-right divbetween">
  325. <span class="level">中级</span><span>15672次播放</span>
  326. </div>
  327. </div>
  328. </div>
  329. <div class="left-right bg p10 udm10">
  330. <img src="img/thinkphp.png" alt="" class="h150 w40" />
  331. <div class="up-down lrp10 texthidden divaround">
  332. <a href=""><h3 class="texthidden">Thinkphp6.0正式版视频教程</h3></a>
  333. <p class="texthidden">
  334. Thinkphp6.0从2019年10月24日正式发布,相对测试版,有很多变
  335. </p>
  336. <div class="left-right divbetween">
  337. <span class="level">中级</span><span>50478次播放</span>
  338. </div>
  339. </div>
  340. </div>
  341. <div class="left-right bg p10 udm10">
  342. <img src="img/python.jpg" alt="" class="h150 w40" />
  343. <div class="up-down lrp10 texthidden divaround">
  344. <a href=""><h3 class="texthidden">2019python自学视频</h3></a>
  345. <p class="texthidden">
  346. 本课程适合想从零开始学习 Python 编程语言的开发人员。由浅入深
  347. </p>
  348. <div class="left-right divbetween">
  349. <span class="level">初级</span><span>37739次播放</span>
  350. </div>
  351. </div>
  352. </div>
  353. </div>
  354. <h2>最新文章</h2>
  355. <div class="up-down">
  356. <div class="left-right bg p10 udm10 divbetween">
  357. <div class="up-down texthidden">
  358. <a href="">
  359. <h3 class="texthidden">
  360. 二进制数 01100011 转换成的十进制数是什么?
  361. </h3>
  362. </a>
  363. <p class="udm10">
  364. 发布时间:2020-04-16
  365. </p>
  366. </div>
  367. <img src="img/python.jpg" alt="" class="w40 h100" />
  368. </div>
  369. <div class="left-right bg p10 udm10 divbetween">
  370. <div class="up-down texthidden">
  371. <a href="">
  372. <h3 class="texthidden">
  373. 二进制数 01100011 转换成的十进制数是什么?
  374. </h3>
  375. </a>
  376. <p class="udm10">
  377. 发布时间:2020-04-16
  378. </p>
  379. </div>
  380. <img src="img/python.jpg" alt="" class="w40 h100" />
  381. </div>
  382. <div class="left-right bg p10 udm10 divbetween">
  383. <div class="up-down texthidden">
  384. <a href="">
  385. <h3 class="texthidden">
  386. 二进制数 01100011 转换成的十进制数是什么?
  387. </h3>
  388. </a>
  389. <p class="udm10">
  390. 发布时间:2020-04-16
  391. </p>
  392. </div>
  393. <img src="img/python.jpg" alt="" class="w40 h100" />
  394. </div>
  395. <div class="left-right divcenter bg udm10 p10"><p>更多内容</p></div>
  396. </div>
  397. <h2>最新博文</h2>
  398. <div class="up-down">
  399. <div class="left-right texthidden bg udm10 p10">
  400. <a href="" class="w60">
  401. <h3 class="texthidden">
  402. 二进制数 01100011 转换成的十进制数是什么?
  403. </h3>
  404. </a>
  405. <div class="w40 up-down divcenter itemend">
  406. <p>2020-04-16</p>
  407. </div>
  408. </div>
  409. <div class="left-right texthidden bg udm10 p10">
  410. <a href="" class="w60">
  411. <h3 class="texthidden">
  412. 二进制数 01100011 转换成的十进制数是什么?
  413. </h3>
  414. </a>
  415. <div class="w40 up-down divcenter itemend">
  416. <p>2020-04-16</p>
  417. </div>
  418. </div>
  419. <div class="left-right texthidden bg udm10 p10">
  420. <a href="" class="w60">
  421. <h3 class="texthidden">
  422. 二进制数 01100011 转换成的十进制数是什么?
  423. </h3>
  424. </a>
  425. <div class="w40 up-down divcenter itemend">
  426. <p>2020-04-16</p>
  427. </div>
  428. </div>
  429. <div class="left-right divcenter bg udm10 p10"><p>更多内容</p></div>
  430. </div>
  431. <div style="height: 50px;"></div>
  432. </div>
  433. <!-- 页脚 -->
  434. <footer>
  435. <!-- <div> -->
  436. <a href=""><span class="iconfont"></span><span>首页</span></a>
  437. <a href=""><span class="iconfont"></span><span>视频</span></a>
  438. <a href=""><span class="iconfont"></span><span>社区</span></a>
  439. <a href=""><span class="iconfont"></span><span>我的</span></a>
  440. <!-- </div> -->
  441. </footer>
  442. </body>
  443. </html>

效果图:

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