Blogger Information
Blog 36
fans 1
comment 0
visits 29663
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html之仿站php.cn
Jason
Original
752 people have browsed it

作业地址

仿站

总结

通过这次大的作业,让我对弹性盒子又有了新的认识,弹性盒子是flex布局的基础,通过padding以及margin的设置来控制间距,用border来画出大概的框架,flex布局将盒模型发挥了极致,用flex可以搭建出任何我们想要的框架模型,主要用到了flex-flow属性来设置,整个项目下来,让我感受最深的就是,知识的整合,很多小的东西容易忘,比如纵轴的对齐方式,一些细节还需要加强练习,总的来说做了项目后,知识点在脑海里又巩固了一遍

效果图如下


代码部分

  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. <style>
  8. @font-face {
  9. font-family: 'iconfont';
  10. src: url('./font_icon/iconfont.eot');
  11. src: url('./font_icon/iconfont.eot?#iefix') format('embedded-opentype'),
  12. url('./font_icon/iconfont.woff2') format('woff2'),
  13. url('./font_icon/iconfont.woff') format('woff'),
  14. url('./font_icon/iconfont.ttf') format('truetype'),
  15. url('./font_icon/iconfont.svg#iconfont') format('svg');
  16. }
  17. .iconfont {
  18. font-family: "iconfont" !important;
  19. font-size: 16px;
  20. font-style: normal;
  21. -webkit-font-smoothing: antialiased;
  22. -moz-osx-font-smoothing: grayscale;
  23. }
  24. /* 初始化 */
  25. * {
  26. padding: 0;
  27. margin: 0;
  28. font-size: 14px;
  29. }
  30. a {
  31. /* 文本下划线 */
  32. text-decoration: none;
  33. color: #666;
  34. }
  35. p {
  36. padding:2px;
  37. }
  38. .big {
  39. font-size:18px;
  40. font-weight: bold;
  41. }
  42. .small {
  43. font-size:10px;
  44. }
  45. html {
  46. /* vw:可视区宽度,100vm:表示沾满100份 */
  47. width: 100vw;
  48. height: 100vh;
  49. /* 在HTML中设置字体大小,给后面的rem单位用 */
  50. font-size: 14px;
  51. }
  52. body {
  53. min-width: 360px;
  54. background-color: #f1f1f1;
  55. display: flex;
  56. flex-flow: column nowrap;
  57. }
  58. body > header {
  59. background-color: gray;
  60. color: lightgray;
  61. height:30px;
  62. display: flex;
  63. align-items: center;
  64. justify-content: space-between;
  65. padding: 0 15px;
  66. position: fixed;
  67. width: 95vw;
  68. }
  69. header > a:not(:last-of-type){
  70. color:honeydew;
  71. }
  72. header > .size {
  73. width: 50px;
  74. height: 20px;
  75. }
  76. /* 设置slider高度 */
  77. body > .slider {
  78. height: 200px;
  79. }
  80. /* 设置图片宽度 */
  81. body > .slider > img {
  82. width: 100%;
  83. height: 100%;
  84. }
  85. nav .size {
  86. width: 50px;
  87. height: 50px;
  88. }
  89. /* 主导航区 */
  90. nav {
  91. /* 设置导航区高度 */
  92. height: 100px;
  93. padding-top: 20px;
  94. display:flex;
  95. /* 变成多行容器 */
  96. flex-flow: row wrap;
  97. }
  98. nav > div > a:first-of-type {
  99. text-align: center;
  100. }
  101. nav > div img {
  102. width: 50%;
  103. }
  104. nav > div {
  105. /* 占宽度四分之一 */
  106. width: 25vw;
  107. display: flex;
  108. flex-flow: column nowrap;
  109. align-items: center;;
  110. }
  111. .title{
  112. color:gray;
  113. font-size: 1.2rem;
  114. padding-left: 12px;
  115. padding-bottom: 10px;
  116. }
  117. .Recommended_courses {
  118. margin-top: 65px;
  119. }
  120. .Recommended_courses > .courses {
  121. width:100vw;
  122. }
  123. .Recently_and_new {
  124. margin-top: 20px;
  125. }
  126. .Recently_and_new > .courses {
  127. width:100vw;
  128. }
  129. .courses {
  130. width: 100vw;
  131. height: 100px;
  132. display: flex;
  133. flex-wrap: nowrap;
  134. }
  135. .courses > .courses-img {
  136. width: 50%;
  137. height: auto;
  138. margin: 0 12px;
  139. justify-content: space-around;
  140. }
  141. .courses > .courses-img > img {
  142. width:100%;
  143. }
  144. .more-list {
  145. width: 95%;
  146. height: 100px;
  147. background-color: #ffffff;
  148. margin: 12px auto;
  149. display: flex;
  150. }
  151. .more-list > .more-img {
  152. width:40%;
  153. height:auto;
  154. margin:12px 12px;
  155. }
  156. .more-list > .more-text {
  157. width:50%;
  158. height:auto;
  159. margin:12px 0;
  160. }
  161. .more-play {
  162. width: 200px;
  163. height:20px;
  164. display: flex;
  165. flex-flow: row nowrap;
  166. justify-content: space-between;
  167. }
  168. .latest-list {
  169. width: 95%;
  170. height: 100px;
  171. background-color: #ffffff;
  172. margin: 12px auto;
  173. display: flex;
  174. }
  175. .latest-list > .latest-img {
  176. width:40%;
  177. height:auto;
  178. margin:12px 0;
  179. }
  180. .latest-list > .latest-text {
  181. width:50%;
  182. height:auto;
  183. margin:12px 12px;
  184. }
  185. .latest-title {
  186. padding: 10px 12px;
  187. }
  188. .Latest-articles > .latest-footer {
  189. width:95%;
  190. margin: 12px auto;
  191. background-color: rgb(255, 255, 255);
  192. text-align: center;
  193. }
  194. .Latest-articles > .latest-footer > p {
  195. padding:12px;
  196. }
  197. /* 最新问答 */
  198. .latest-box {
  199. width: 95%;
  200. height: 70px;
  201. background-color: #ffffff;
  202. margin: 12px auto;
  203. display: flex;
  204. justify-content: space-between;
  205. }
  206. .latest-question {
  207. padding:12px 12px;
  208. }
  209. .latest-answer{
  210. padding:12px 12px;
  211. }
  212. .latest-qa > .latest-more {
  213. width:95%;
  214. margin: 12px auto;
  215. background-color: rgb(255, 255, 255);
  216. text-align: center;
  217. }
  218. .latest-qa > .latest-more > p {
  219. padding:12px;
  220. }
  221. /* 底部导航栏 */
  222. body >footer {
  223. color: 666;
  224. background-color: cadetblue;
  225. border-top: 1px solid #ccc;
  226. height: 50px;
  227. position: fixed;
  228. bottom: 0;
  229. width: 100vw;
  230. display: flex;
  231. justify-content: space-around;
  232. }
  233. body > footer > a {
  234. margin-top: 10px;
  235. font-size: 0.8rem;
  236. display: flex;
  237. flex-flow: column nowrap;
  238. align-items: center;
  239. }
  240. body > footer > a > span:first-of-type {
  241. font-size: 1.6rem;
  242. }
  243. footer .size{
  244. width:30px;
  245. height:30px;
  246. }
  247. </style>
  248. </head>
  249. <body>
  250. <!-- 页眉 -->
  251. <header>
  252. <a href="">LOGO</a>
  253. <a href="">PHP中文网</a>
  254. <a href="">
  255. <span>
  256. <span class="iconfont size">&#xe652;</span>
  257. </span>
  258. </a>
  259. </header>
  260. <!-- 轮播图 -->
  261. <div class="slider">
  262. <img src="static/images/banner.png" alt="" />
  263. </div>
  264. <!-- 主导航区 -->
  265. <nav>
  266. <div>
  267. <a href="">
  268. <span class="iconfont size">&#xe8af;</span>
  269. </a>
  270. <a href="">HTML/css</a>
  271. </div>
  272. <div>
  273. <a href="">
  274. <span class="iconfont size">&#xe614;</span>
  275. </a>
  276. <a href="">JavaScript</a>
  277. </div>
  278. <div>
  279. <a href="">
  280. <span class="iconfont size">&#xe70b;</span>
  281. </a>
  282. <a href="">服务端</a>
  283. </div>
  284. <div>
  285. <a href="">
  286. <span class="iconfont size">&#xe8af;</span>
  287. </a>
  288. <a href="">数据库</a>
  289. </div>
  290. <div>
  291. <a href="">
  292. <span class="iconfont size">&#xe670;</span>
  293. </a>
  294. <a href="">直播</a>
  295. </div>
  296. <div>
  297. <a href="">
  298. <span class="iconfont size">&#xe63f;</span>
  299. </a>
  300. <a href="">移动端</a>
  301. </div>
  302. <div>
  303. <a href="">
  304. <span class="iconfont size">&#xe617;</span>
  305. </a>
  306. <a href="">手册</a>
  307. </div>
  308. <div>
  309. <a href="">
  310. <span class="iconfont size">&#xe648;
  311. </span>
  312. </a>
  313. <a href="">工具</a>
  314. </div>
  315. </nav>
  316. <!-- 推荐课程 -->
  317. <div class="Recommended_courses">
  318. <h2 class="title">推荐课程</h2>
  319. <!-- banner部分 -->
  320. <div class="courses">
  321. <div class="courses-img">
  322. <a href=""><img src="static/images/1.jpg" width="100%" height="100%"/></a>
  323. </div>
  324. <div class="courses-img">
  325. <a href=""><img src="static/images/1.jpg" width="100%" height="100%"/></a>
  326. </div>
  327. </div>
  328. <!-- 详情部分 -->
  329. <div class="more">
  330. <div class="more-list">
  331. <div class="more-img">
  332. <a href=""><img src="static/images/2.jpg" width="100%" height="100%"/></a>
  333. </div>
  334. <div class="more-text">
  335. <p class="big"><a href="">CI框架30分钟极速入门</a></p>
  336. <p class="small">
  337. <svg class="icon size" aria-hidden="true">
  338. <use xlink:href="#icon--devil"></use>
  339. </svg> 61272次播放</p>
  340. </div>
  341. </div>
  342. </div>
  343. <div class="more">
  344. <div class="more-list">
  345. <div class="more-img">
  346. <a href=""><img src="static/images/2.jpg" width="100%" height="100%"/></a>
  347. </div>
  348. <div class="more-text">
  349. <p class="big"><a href="">CI框架30分钟极速入门</a></p>
  350. <p class="small">
  351. <svg class="icon size" aria-hidden="true">
  352. <use xlink:href="#icon--devil"></use>
  353. </svg> 61272次播放</p>
  354. </div>
  355. </div>
  356. </div>
  357. </div>
  358. <!-- 最近跟新 -->
  359. <div class="Recently_and_new">
  360. <h2 class="title">最近跟新</h2>
  361. <!-- 详情部分 -->
  362. <div class="more">
  363. <div class="more-list">
  364. <div class="more-img">
  365. <a href=""><img src="static/images/2.jpg" width="100%" height="100%"/></a>
  366. </div>
  367. <div class="more-text">
  368. <p class="big"><a href="">CI框架30分钟极速入门</a></p>
  369. <p class="small">CI框架30分钟极速入门</p>
  370. <div class="more-play">
  371. <div class="more-left">
  372. <span>
  373. <svg class="icon size" aria-hidden="true">
  374. <use xlink:href="#icon--devil"></use>
  375. </svg>
  376. </span>
  377. </div>
  378. <div class="more-right">
  379. <span class="small">
  380. 61272次播放
  381. </span>
  382. </div>
  383. </div>
  384. </div>
  385. </div>
  386. </div>
  387. <div class="more">
  388. <div class="more-list">
  389. <div class="more-img">
  390. <a href=""><img src="static/images/2.jpg" width="100%" height="100%"/></a>
  391. </div>
  392. <div class="more-text">
  393. <p class="big"><a href="">CI框架30分钟极速入门</a></p>
  394. <p class="small">CI框架30分钟极速入门</p>
  395. <div class="more-play">
  396. <div class="more-left">
  397. <span>
  398. <svg class="icon size" aria-hidden="true">
  399. <use xlink:href="#icon--devil"></use>
  400. </svg>
  401. </span>
  402. </div>
  403. <div class="more-right">
  404. <span class="small">
  405. 61272次播放
  406. </span>
  407. </div>
  408. </div>
  409. </div>
  410. </div>
  411. </div>
  412. <div class="more">
  413. <div class="more-list">
  414. <div class="more-img">
  415. <a href=""><img src="static/images/2.jpg" width="100%" height="100%"/></a>
  416. </div>
  417. <div class="more-text">
  418. <p class="big"><a href="">CI框架30分钟极速入门</a></p>
  419. <p class="small">CI框架30分钟极速入门</p>
  420. <div class="more-play">
  421. <div class="more-left">
  422. <span>
  423. <svg class="icon size" aria-hidden="true">
  424. <use xlink:href="#icon--devil"></use>
  425. </svg>
  426. </span>
  427. </div>
  428. <div class="more-right">
  429. <span class="small">
  430. 61272次播放
  431. </span>
  432. </div>
  433. </div>
  434. </div>
  435. </div>
  436. </div>
  437. </div>
  438. <!-- 最新文章 -->
  439. <!-- 最近跟新 -->
  440. <div class="Latest-articles">
  441. <h2 class="title">最新文章</h2>
  442. <!-- 详情部分 -->
  443. <div class="latest">
  444. <div class="latest-list">
  445. <div class="latest-text">
  446. <p class="big"><a href="">thinkphp5 + barcode 生成条形码的方法</a></p>
  447. <p class="small">发布时间:2020-04-12</p>
  448. </div>
  449. <div class="latest-img">
  450. <a href=""><img src="static/images/3.jpg" width="100%" height="100%"/></a>
  451. </div>
  452. </div>
  453. </div>
  454. <div class="latest">
  455. <div class="latest-list">
  456. <div class="latest-text">
  457. <p class="big"><a href="">如何使用html+css+js实现3D相册</a></p>
  458. <p class="small">发布时间:2020-04-12</p>
  459. </div>
  460. <div class="latest-img">
  461. <a href=""><img src="static/images/3.jpg" width="100%" height="100%"/></a>
  462. </div>
  463. </div>
  464. </div>
  465. <div class="latest">
  466. <div class="latest-list">
  467. <div class="latest-text">
  468. <p class="big"><a href="">CI框架30分钟极速入门</a></p>
  469. <p class="small">发布时间:2020-04-12</p>
  470. </div>
  471. <div class="latest-img">
  472. <a href=""><img src="static/images/3.jpg" width="100%" height="100%"/></a>
  473. </div>
  474. </div>
  475. </div>
  476. <div class="latest-footer">
  477. <p>更多内容</p>
  478. </div>
  479. </div>
  480. </div>
  481. <!-- 最新问答 -->
  482. <div class="latest-qa">
  483. <h2 class="title">最新文章</h2>
  484. <div class="latest-box">
  485. <div class="latest-question">
  486. <p class="big">CSS3:弹性盒子flex布局</p>
  487. </div>
  488. <div class="latest-answer">
  489. <p class="small">2020-04-12</p>
  490. </div>
  491. </div>
  492. <div class="latest-box">
  493. <div class="latest-question">
  494. <p class="big">Composer windows安装详细介绍</p>
  495. </div>
  496. <div class="latest-answer">
  497. <p class="small">2020-04-12</p>
  498. </div>
  499. </div>
  500. <div class="latest-box">
  501. <div class="latest-question">
  502. <p class="big">Jquery+AJAX上传文件,无刷新上传并重命名文件</p>
  503. </div>
  504. <div class="latest-answer">
  505. <p class="small">2020-04-12</p>
  506. </div>
  507. </div>
  508. <div class="latest-more">
  509. <p>更多内容</p>
  510. </div>
  511. </div>
  512. <!-- 页脚 -->
  513. <footer>
  514. <a href="">
  515. <span>
  516. <span class="iconfont size">&#xe621;</span>
  517. </span>
  518. <span>
  519. 首页
  520. </span>
  521. </a>
  522. <a href="">
  523. <span>
  524. <span class="iconfont size">&#xe618;</span>
  525. </span>
  526. <span>
  527. 视频
  528. </span>
  529. </a>
  530. <a href="">
  531. <span>
  532. <span class="iconfont size">&#xe6f9;</span>
  533. </span>
  534. <span>
  535. 社区
  536. </span>
  537. </a>
  538. <a href="">
  539. <span>
  540. <span class="iconfont size">&#xe61d;
  541. </span>
  542. </span>
  543. <span>
  544. 我的
  545. </span>
  546. </a>
  547. </footer>
  548. </body>
  549. </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