Blogger Information
Blog 12
fans 0
comment 0
visits 8541
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php中文网移动端首页仿写
brait
Original
568 people have browsed it

1.仿写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. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <link rel="stylesheet" href="static/css/init.css">
  8. <link rel="stylesheet" href="static/css/style.css">
  9. <title>Document</title>
  10. </head>
  11. <body>
  12. <header>
  13. <img src="static/images/user-pic.jpeg" alt="">
  14. <img src="static/images/logo.png" alt="">
  15. <img src="static/images/user-nav.jpg" alt="">
  16. </header>
  17. <!-- 轮播图 -->
  18. <div class="banner">
  19. <img src="static/images/banner.jpg" alt="">
  20. </div>
  21. <!-- 导航 -->
  22. <nav>
  23. <ul>
  24. <li>
  25. <a href="">
  26. <img src="static/images/html.png" alt="">
  27. <span>HTML/CSS</span>
  28. </a>
  29. </li>
  30. <li>
  31. <a href="">
  32. <img src="static/images/JavaScript.png" alt="">
  33. <span>JavaScript</span>
  34. </a>
  35. </li>
  36. <li>
  37. <a href="">
  38. <img src="static/images/code.png" alt="">
  39. <span>服务端</span>
  40. </a>
  41. </li>
  42. <li>
  43. <a href="">
  44. <img src="static/images/sql.png" alt="">
  45. <span>数据库</span>
  46. </a>
  47. </li>
  48. </ul>
  49. <ul>
  50. <li>
  51. <a href=""><img src="static/images/app.png" alt="">
  52. <span>移动端</span>
  53. </a>
  54. </li>
  55. <li>
  56. <a href="">
  57. <img src="static/images/manual.png" alt="">
  58. <span>手册</span>
  59. </a>
  60. </li>
  61. <li>
  62. <a href=""><img src="static/images/tool2.png" alt="">
  63. <span>工具</span>
  64. </a>
  65. </li>
  66. <li>
  67. <a href="">
  68. <img src="static/images/live.png" alt="">
  69. <span>直播</span>
  70. </a>
  71. </li>
  72. </ul>
  73. </nav>
  74. <!-- 主体 -->
  75. <main>
  76. <!-- 课程推荐 -->
  77. <article class="recommend">
  78. <h3>推荐课程</h3>
  79. <section>
  80. <a href=""><img src="static/images/tjkc1.jpg" alt=""></a>
  81. <a href=""><img src="static/images/tjkc2.jpg" alt=""></a>
  82. </section>
  83. <section>
  84. <div>
  85. <a href=""><img src="static/images/tjkc3.jpg" alt=""></a>
  86. <span>
  87. <a href="">CI框架30分钟极速入门</a>
  88. <span><i>中级</i>49738次播放</span>
  89. </span>
  90. </div>
  91. <div>
  92. <a href=""><img src="static/images/tjkc3.jpg" alt=""></a>
  93. <span>
  94. <a href="">CI框架30分钟极速入门</a>
  95. <span><i>中级</i>49738次播放</span>
  96. </span>
  97. </div>
  98. </section>
  99. </article>
  100. <article class="newcourse">
  101. <h3>最新课程</h3>
  102. <section>
  103. <div>
  104. <a href=""><img src="static/images/npic1.png" alt=""></a>
  105. <span>
  106. <a href="">CI框架30分钟极速入门</a>
  107. <span><i>中级</i>49738次播放</span>
  108. </span>
  109. </div>
  110. <div>
  111. <a href=""><img src="static/images/npic2.png" alt=""></a>
  112. <span>
  113. <a href="">CI框架30分钟极速入门</a>
  114. <span><i>中级</i>49738次播放</span>
  115. </span>
  116. </div>
  117. <div>
  118. <a href=""><img src="static/images/npic3.png" alt=""></a>
  119. <span>
  120. <a href="">CI框架30分钟极速入门</a>
  121. <span><i>中级</i>49738次播放</span>
  122. </span>
  123. </div>
  124. </section>
  125. </article>
  126. <!-- 最新文章 -->
  127. <article class="narticle">
  128. <h3>最新文章</h3>
  129. <div>
  130. <span>
  131. <a href=""><span>PHP如何去除数组中的空值(图文+视频)</span></a>发布时间:2018-10-09
  132. </span>
  133. <a href=""><img src="static/images/nar1.png" alt=""></a>
  134. </div>
  135. <div>
  136. <span>
  137. <a href=""><span>PHP如何去除数组中的空值(图文+视频)</span></a>发布时间:2018-10-09
  138. </span>
  139. <a href=""><img src="static/images/nar1.png" alt=""></a>
  140. </div>
  141. <div>
  142. <span>
  143. <a href=""><span>PHP如何去除数组中的空值(图文+视频)</span></a>发布时间:2018-10-09
  144. </span>
  145. <a href=""><img src="static/images/nar1.png" alt=""></a>
  146. </div>
  147. <div>
  148. <span>更多内容</span>
  149. </div>
  150. </article>
  151. <!-- 最新博文 -->
  152. <article class="nblog">
  153. <h3>最新博文</h3>
  154. <div>
  155. <span><a href="">移动端/手机端去除横向进度条</a>
  156. <span>2019-11-08</span>
  157. </span>
  158. </div>
  159. <div>
  160. <span><a href="">移动端/手机端去除横向进度条</a>
  161. <span>2019-11-08</span>
  162. </span>
  163. </div>
  164. <div>
  165. <span><a href="">移动端/手机端去除横向进度条</a>
  166. <span>2019-11-08</span>
  167. </span>
  168. </div>
  169. <div>
  170. <span>更多内容</span>
  171. </div>
  172. </article>
  173. </main>
  174. <!-- 底部 -->
  175. <footer>
  176. <a href=""><img src="static/font-icon/zhuye.png" alt=""><span>主页</span></a>
  177. <a href="">
  178. <img src="static/font-icon/video.png" alt="">
  179. <span>视频</span>
  180. </a>
  181. <a href="">
  182. <img src="static/font-icon/luntan.png" alt="">
  183. <span>社区</span>
  184. </a>
  185. <a href="">
  186. <img src="static/font-icon/geren.png" alt="">
  187. <span>我的</span>
  188. </a>
  189. </footer>
  190. </body>
  191. </html>

CSS部分:

  1. /* 头部 */
  2. header{
  3. position: fixed;
  4. top:0;
  5. width:100%;
  6. height: 42px;
  7. background-color: #444444;
  8. color:white;
  9. min-width: 320px;
  10. max-width: 768px;
  11. display: flex;
  12. justify-content: space-between;
  13. align-items: center;
  14. }
  15. header > img:first-of-type,
  16. header > img:last-of-type{
  17. width: 26px;
  18. height: 26px;
  19. margin: 5px;
  20. }
  21. header > img:first-of-type{
  22. border-radius:50% ;
  23. }
  24. header > img{
  25. width:94px;
  26. }
  27. /* 轮播图 */
  28. div > .banner {
  29. display: flex;
  30. height: 200px;
  31. }
  32. /* 导航 */
  33. nav{
  34. background-color: white;
  35. display: flex;
  36. flex-flow:column nowrap;
  37. }
  38. nav img{
  39. width: 45px;
  40. height: 49px;
  41. }
  42. nav ul {
  43. display: flex;
  44. }
  45. nav ul li {
  46. flex: 1;
  47. }
  48. nav ul li a {
  49. display: flex;
  50. flex-flow: column wrap;
  51. align-items: center;
  52. margin:10px;
  53. }
  54. nav ul li a span{
  55. margin-top: 5px;
  56. }
  57. /* 推荐课程 */
  58. main > .recommend > section:first-of-type{
  59. display: flex;
  60. }
  61. main > .recommend > section:first-of-type > a {
  62. margin: 5px;
  63. flex: 1;
  64. }
  65. main > .recommend > section:first-of-type > a > img{
  66. height: 90px;
  67. }
  68. main > .recommend > section:last-of-type{
  69. display: flex;
  70. flex: 1;
  71. flex-flow: column nowrap;
  72. margin: 5px;
  73. }
  74. main > .recommend > section:last-of-type > div img{
  75. width: 350px;
  76. height: 90px;
  77. }
  78. main > .recommend > section:last-of-type > div{
  79. display: flex;
  80. margin-bottom: 10px;
  81. background-color: white;
  82. }
  83. main > .recommend > section:last-of-type > div > span{
  84. display: flex;
  85. flex-flow: column wrap;
  86. margin-top: 5px;
  87. padding-left: 10px;
  88. }
  89. main > .recommend > section:last-of-type > div > span i{
  90. font-style: normal;
  91. background-color: #444444;
  92. border-radius: 4px;
  93. padding:0 5px;
  94. color: white;
  95. }
  96. /* 最新课程 */
  97. main > .newcourse >section {
  98. display: flex;
  99. flex-flow: column nowrap;
  100. }
  101. main >.newcourse img{
  102. width: 350px;
  103. height: 90px;
  104. }
  105. main > .newcourse div{
  106. display: flex;
  107. margin-bottom: 10px;
  108. background-color: white;
  109. padding:10px;
  110. }
  111. main > .newcourse div > span{
  112. display: flex;
  113. flex-flow: column wrap;
  114. margin-top: 5px;
  115. padding-left: 10px;
  116. }
  117. main > .newcourse div > span i{
  118. font-style: normal;
  119. background-color: #444444;
  120. border-radius: 4px;
  121. color:white;
  122. }
  123. main > .narticle >div{
  124. background-color: white;
  125. display: flex;
  126. justify-content: space-between;
  127. margin-bottom: 10px;
  128. padding: 5px;
  129. }
  130. main > .narticle >div img{
  131. margin-right: 10px;
  132. width: 330px;
  133. height: 70px;
  134. margin-top: 5px;
  135. padding-left: 10px;
  136. }
  137. main > .narticle > div > span{
  138. display: flex;
  139. flex-flow: column wrap;
  140. padding-top: 20px;
  141. padding-left: 20px;
  142. }
  143. main > .narticle >div:last-of-type >span{
  144. margin:0 auto;
  145. padding:5px;
  146. }
  147. /* 最新博文 */
  148. main > .nblog >div{
  149. background-color: white;
  150. display: flex;
  151. flex-flow: column nowrap;
  152. margin-bottom: 10px;
  153. padding: 5px;
  154. }
  155. main > .nblog >div>span{
  156. margin-bottom: 10px;
  157. padding: 10px;
  158. display: flex;
  159. justify-content: space-between;
  160. align-content: center;
  161. }
  162. main > .nblog >div:last-of-type >span{
  163. margin:0 auto;
  164. padding:5px;
  165. }
  166. /* 底部 */
  167. footer{
  168. position: fixed;
  169. bottom: 0;
  170. width:100%;
  171. height: 42px;
  172. padding: 3px;
  173. min-width: 320px;
  174. max-width: 768px;
  175. display: flex;
  176. justify-content: space-around;
  177. align-items: center;
  178. }
  179. footer a img {
  180. width: 16px;
  181. height: 16px;
  182. margin: 5px;
  183. }
  184. footer a {
  185. display: flex;
  186. flex-flow: column wrap;
  187. margin: 3px;
  188. }
  189. body{
  190. height: 2500px;
  191. }

运行效果:


2.手抄导航区代码


3.总结

学的时候觉得好像都记下来了,真的到了仿写的时候就傻眼了,根本没有思绪。我还是坚持关掉老师的示例代码,速度慢的和刚学打字一样,慢慢的敲。还是那句话,一层层嵌套的盒子只要不搞混,就不会写不出来。

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