Blogger Information
Blog 28
fans 0
comment 0
visits 25673
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
使用flex布局实现php中文网移动端网页布局
,多思曩惜,
Original
565 people have browsed it

代码

  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/font-icon.css">
  7. <title>实战php移动端</title>
  8. <style>
  9. /* 初始化 */
  10. * {
  11. margin: 0;
  12. padding: 0;
  13. }
  14. /* 定义文本 */
  15. a {
  16. text-decoration: none;
  17. color: #666;
  18. }
  19. html {
  20. /* vw: 可视区宽度,100vw:表示占满100份 */
  21. width: 100vw;
  22. height: 100vh;
  23. /* vw: 可视区宽度,100vw:表示占满100份 */
  24. font-size: 14px;
  25. }
  26. body {
  27. /* 设置页面拉伸最大值,页面背景色,将body设置为弹性盒子,并设置不能拉升 */
  28. min-width: 360px;
  29. background-color: rgb(250, 227, 227);
  30. display: flex;
  31. flex-flow: column nowrap;
  32. }
  33. body>header {
  34. /* 设置头部背景色,内容色,头部大小,头部弹性盒子,文本内容居中,
  35. 文本周围空白区域,元素填充 */
  36. background-color: #2c2e2f;
  37. color: white;
  38. height: 30px;
  39. display: flex;
  40. align-items: center;
  41. justify-content: space-between;
  42. padding: 0 5px;
  43. /* 将头部绝对定位 */
  44. position: fixed;
  45. width: 97vw;
  46. }
  47. .user {
  48. color: rgb(151, 148, 148);
  49. font-size: 1.7rem;
  50. }
  51. .user1 {
  52. height: 50px;
  53. }
  54. body>.slider {
  55. margin-top: 30px;
  56. height: 160px;
  57. }
  58. .slider>img {
  59. width: 100%;
  60. height: 100%;
  61. }
  62. nav {
  63. height: 200px;
  64. display: flex;
  65. flex-flow: row wrap;
  66. }
  67. nav>div>a {
  68. width: 25vw;
  69. display: flex;
  70. flex-flow: column nowrap;
  71. align-items: center;
  72. margin-top: 12px;
  73. }
  74. nav>div>a :first-of-type {
  75. text-align: center;
  76. }
  77. nav>div img {
  78. width: 50%;
  79. }
  80. h2 {
  81. padding: 3px;
  82. margin-top: 4px;
  83. background-color: lightgray;
  84. font-size: 1.2rem;
  85. color: rgb(68, 68, 67);
  86. display: flex;
  87. align-items: center;
  88. }
  89. main {
  90. display: flex;
  91. flex-flow: row wrap;
  92. justify-content: space-between;
  93. }
  94. main>div>a {
  95. margin-top: 5px;
  96. width: 50vw;
  97. display: flex;
  98. flex-flow: column nowrap;
  99. align-items: center;
  100. }
  101. main>div img {
  102. flex: 1 0 30vw;
  103. width: 95%;
  104. }
  105. .goods-desc {
  106. height: 93.7px;
  107. width: 100vw;
  108. display: flex;
  109. flex-flow: row wrap;
  110. margin-top: 5px;
  111. margin-left: 10px;
  112. }
  113. .teacher {
  114. width: 44vw;
  115. }
  116. .teacher>div {
  117. text-overflow: ellipsis;
  118. overflow: hidden;
  119. white-space: nowrap;
  120. }
  121. .goods-desc>div {
  122. width: 45vw;
  123. height: 80px;
  124. }
  125. .goods-desc>div>a img {
  126. display: block;
  127. width: 100%;
  128. height: 100%;
  129. }
  130. .goods-desc>.teacher {
  131. margin-top: 10px;
  132. margin-left: 15px;
  133. font-size: 1rem;
  134. }
  135. .goods-desc>.teacher>div:last-of-type {
  136. margin-top: 5px;
  137. }
  138. .teacher>div:nth-of-type(2) {
  139. margin-top: 5px;
  140. font-size: 0.5rem;
  141. }
  142. .teacher>div:last-of-type {
  143. display: flex;
  144. justify-content: space-between;
  145. padding: 5px 1px;
  146. }
  147. .answer>div {
  148. width: 375px;
  149. }
  150. .answer>div>div {
  151. margin-left: 5vw;
  152. width: 350px;
  153. height: 40px;
  154. box-shadow: 2px 2px 10px #999;
  155. }
  156. .answer>div>div>a {
  157. margin-top: 10px;
  158. display: flex;
  159. flex-flow: row nowrap;
  160. justify-content: space-between;
  161. padding: 0 25px;
  162. }
  163. .answer>div>div>a>span:first-of-type {
  164. width: 200px;
  165. font-size: 1.1rem;
  166. text-overflow: ellipsis;
  167. overflow: hidden;
  168. white-space: nowrap;
  169. }
  170. .answer>div>div>a>span:last-of-type {
  171. font-size: 0.5rem;
  172. margin-top: 4px;
  173. }
  174. body>footer {
  175. color: rgb(2, 2, 2);
  176. background-color: #c4bfbf;
  177. border: 1px solid rgb(233, 229, 229);
  178. height: 55px;
  179. position: fixed;
  180. bottom: 0;
  181. width: 100vw;
  182. display: flex;
  183. justify-content: space-around;
  184. }
  185. body>footer>a {
  186. margin-top: 10px;
  187. font-size: 1rem;
  188. display: flex;
  189. flex-flow: column nowrap;
  190. align-items: center;
  191. }
  192. .more {
  193. margin-top: 4px;
  194. color: #888888;
  195. display: flex;
  196. font-size: 1rem;
  197. justify-content: center;
  198. }
  199. </style>
  200. </head>
  201. <body>
  202. <!-- 页眉 -->
  203. <header>
  204. <a href=""><span class="iconfont user">&#xe65b;</span></a>
  205. <a href=""><img src="images/logo.png" alt="" class="user1"></a>
  206. <a href=""><span class="iconfont user">&#xe61f;</span></a>
  207. </header>
  208. <!-- 头部 -->
  209. <div class="slider">
  210. <img src="images/3.jpg" alt="">
  211. </div>
  212. <!-- 菜单 -->
  213. <menu>
  214. <nav>
  215. <div>
  216. <a href=""><img src="images/html.png" alt=""></a>
  217. <a href="">HTML/CSS</a>
  218. </div>
  219. <div>
  220. <a href=""><img src="images/JavaScript.png" alt=""></a>
  221. <a href="">JavaScript</a>
  222. </div>
  223. <div>
  224. <a href=""><img src="images/code.png" alt=""></a>
  225. <a href="">服务端</a>
  226. </div>
  227. <div>
  228. <a href=""><img src="images/sql.png" alt=""></a>
  229. <a href="">数据库</a>
  230. </div>
  231. <div>
  232. <a href=""><img src="images/app.png" alt=""></a>
  233. <a href="">移动端</a>
  234. </div>
  235. <div>
  236. <a href=""><img src="images/manual.png" alt=""></a>
  237. <a href="">手册</a>
  238. </div>
  239. <div>
  240. <a href=""><img src="images/tool2.png" alt=""></a>
  241. <a href="">工具</a>
  242. </div>
  243. <div>
  244. <a href=""><img src="images/live.png" alt=""></a>
  245. <a href="">直播</a>
  246. </div>
  247. </nav>
  248. </menu>
  249. <!-- 推荐课程 -->
  250. <h2 class="tittle">推荐课程</h2>
  251. <main>
  252. <div class="class1">
  253. <a href=""><img src="images/tianlong.jpg" alt=""></a>
  254. </div>
  255. <div class="class1">
  256. <a href=""><img src="images/tianlong.jpg" alt=""></a>
  257. </div>
  258. </main>
  259. <div class="goods-desc">
  260. <div>
  261. <a href=""><img src="images/ci.jpg" alt=""></a>
  262. </div>
  263. <div class="teacher">
  264. <div>
  265. <a href="">CI框架30分钟极速入门</a>
  266. </div>
  267. <div>
  268. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  269. <span style="font-size: 0.8rem;">61329次播放</span>
  270. </div>
  271. </div>
  272. </div>
  273. <div class="goods-desc">
  274. <div>
  275. <a href=""><img src="images/ci.jpg" alt=""></a>
  276. </div>
  277. <div class="teacher">
  278. <div>
  279. <a href="">CI框架30分钟极速入门</a>
  280. </div>
  281. <div>
  282. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  283. <span style="font-size: 0.8rem;">61329次播放</span>
  284. </div>
  285. </div>
  286. </div>
  287. <!-- 最新更新 -->
  288. <h2 class="tittle">最新更新</h2>
  289. <div class="goods-desc">
  290. <div>
  291. <a href=""><img src="images/excel.png" alt=""></a>
  292. </div>
  293. <div class="teacher">
  294. <div>
  295. <a href="">PHP快速操控Excel之PhpSpreadsheet</a>
  296. </div>
  297. <div>
  298. <a href="">老的PHPExcel已经停止更新了!目前最新的是使用phpOffice插件PhpSpreadsheet,用纯 php
  299. 编写的库,它提供了一组类,允许您读取和写入不同的电子表格文件格式!php中文网欧阳克老师原创课程!注:PHP运行环境需要PHP7.1以上</a>
  300. </div>
  301. <div>
  302. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  303. <span style="font-size: 0.8rem;">61329次播放</span>
  304. </div>
  305. </div>
  306. </div>
  307. <div class="goods-desc">
  308. <div>
  309. <a href=""><img src="images/thinkphp.png" alt=""></a>
  310. </div>
  311. <div class="teacher">
  312. <div>
  313. <a href="">Thinkphp6.0正式版视频教程</a>
  314. </div>
  315. <div>
  316. <a href="">Thinkphp6.0从2019年10月24日正式发布,相对测试版,有很多变动,目前TP6已经相对比较稳定了,所以php中文网在2020年再次重新录制课程,
  317. 帮助快速入门!相关推荐: ThinkPHP6.0完全开发手册(注解版) https://www.php.cn/course/1049.html</a>
  318. </div>
  319. <div>
  320. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  321. <span style="font-size: 0.8rem;">61329次播放</span>
  322. </div>
  323. </div>
  324. </div>
  325. <div class="goods-desc">
  326. <div>
  327. <a href=""><img src="images/Python.jpg" alt=""></a>
  328. </div>
  329. <div class="teacher">
  330. <div>
  331. <a href="">2019python自学视频</a>
  332. </div>
  333. <div>
  334. <a href="">本课程适合想从零开始学习 Python 编程语言的开发人员。由浅入深的带你进入python世界,自学python的一份好课程,兄弟连课程</a>
  335. </div>
  336. <div>
  337. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  338. <span style="font-size: 0.8rem;">61329次播放</span>
  339. </div>
  340. </div>
  341. </div>
  342. <div class="goods-desc">
  343. <div>
  344. <a href=""><img src="images/php.png" alt=""></a>
  345. </div>
  346. <div class="teacher">
  347. <div>
  348. <a href="">PHP开发免费公益直播课</a>
  349. </div>
  350. <div>
  351. <a href="">主讲:php中文网-朱老师( Peter Zhu) 时间:2019.10.17 晚 20:00-22:00 主题:如何高效的学习一门新技术? 具体内容:1. 2020了,
  352. 还有哪些值得学习的新技术?
  353. 2.如何高效的学习前端开发? 3.如果高效的学习PHP开发?4.phpStudy V8 新功能介绍与演示 5.小皮面板功能介绍</a>
  354. </div>
  355. <div>
  356. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  357. <span style="font-size: 0.8rem;">61329次播放</span>
  358. </div>
  359. </div>
  360. </div>
  361. <div class="goods-desc">
  362. <div>
  363. <a href=""><img src="images/none.jpg" alt=""></a>
  364. </div>
  365. <div class="teacher">
  366. <div>
  367. <a href="">从零开始到WEB响应式布局</a>
  368. </div>
  369. <div>
  370. <a href="">重点介绍了HTML、CSS、web布局前端核心技术,通过视频讲解,了解可以利用HTML+CSS做什么,有相关工具、后端语言,逻辑思维训练等知识点</a>
  371. </div>
  372. <div>
  373. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  374. <span style="font-size: 0.8rem;">61329次播放</span>
  375. </div>
  376. </div>
  377. </div>
  378. <div class="goods-desc">
  379. <div>
  380. <a href=""><img src="images/zero.png" alt=""></a>
  381. </div>
  382. <div class="teacher">
  383. <div>
  384. <a href="">PHP文件基础操作</a>
  385. </div>
  386. <div>
  387. <a href="">好多同学在PHP基础的时候对PHP文件的操作了解的不够多,本节课就带着大家来学习PHP文件的基础操作,
  388. PHP操作文件主要用到的就是PHP文件相关的函数,那么我们主要讲的也就是PHP文件相关的各种函数,相信本节课程会让你对PHP更感兴趣哦!</a>
  389. </div>
  390. <div>
  391. <span style="border-radius: 10px; color: white;background-color: rgb(114, 112, 112);">中级</span>
  392. <span style="font-size: 0.8rem;">61329次播放</span>
  393. </div>
  394. </div>
  395. </div>
  396. <!-- 最近文章 -->
  397. <!-- 最新博客 -->
  398. <!-- 最新问答 -->
  399. <div class="answer">
  400. <h2 class="tittle">最新问答</h2>
  401. <div>
  402. <div>
  403. <a href="">
  404. <a href=""><span>快捷键</span>
  405. <span>2020-4-2</span>
  406. </a>
  407. </a>
  408. </div>
  409. </div>
  410. <div>
  411. <div>
  412. <a href="">
  413. <a href=""><span>后台的模板在哪里找</span>
  414. <span>2020-4-12</span>
  415. </a>
  416. </a>
  417. </div>
  418. </div>
  419. <div>
  420. <div>
  421. <a href="">
  422. <a href=""><span>数据库</span>
  423. <span>2020-4-10</span>
  424. </a>
  425. </a>
  426. </div>
  427. </div>
  428. <div>
  429. <div>
  430. <a href="">
  431. <a href=""><span>如何判断一个变量是否是变量名还是对象名</span>
  432. <span>2020-4-18</span>
  433. </a>
  434. </a>
  435. </div>
  436. </div>
  437. <a class="more">
  438. <p>更多内容</p>
  439. </a>
  440. </div>
  441. <div style="margin-top: 65px;"></div>
  442. <!-- 页脚 -->
  443. <footer>
  444. <a href="">
  445. <span class="iconfont">&#xe60c;</span>
  446. <span>首页</span>
  447. </a>
  448. <a href="">
  449. <span class="iconfont">&#xe64b;</span>
  450. <span>菜单</span>
  451. </a>
  452. <a href="">
  453. <span class="iconfont">&#xe602;</span>
  454. <span>购物车</span>
  455. </a>
  456. <a href="">
  457. <span class="iconfont">&#xe657;</span>
  458. <span>会员</span>
  459. </a>
  460. </footer>
  461. </body>
  462. </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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!