博客列表 >布局实战小结

布局实战小结

P粉317509817
P粉317509817原创
2022年03月27日 11:07:35555浏览

仿写PHP中文网结构

代码

html

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link rel="stylesheet" href="static/css/initial.css">
  8. <link rel="stylesheet" href="static/css/top.css">
  9. <link rel="stylesheet" href="static/css/main.css">
  10. <link rel="stylesheet" href="static/css/lastest.css">
  11. <link rel="stylesheet" href="//at.alicdn.com/t/font_3279636_17208zykr8dj.css">
  12. <title>php中文网</title>
  13. </head>
  14. <body>
  15. <div class="header">
  16. <div class="top">
  17. <div class="title">
  18. <span>php中文网-程序员梦开始的地方</span>
  19. </div>
  20. <div class="userimg">
  21. <a href="" class="iconfont icon-lingdang-xianxing"></a>
  22. <a href=""><img src="static/images/wallhaven-j3dg1m.jpg" alt=""></a>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="nav">
  27. <div class="content">
  28. <a href="" class="logo"><img src="static/images/logo.png" alt=""></a>
  29. <div class="meddle">
  30. <a href="" class="item">首页</a>
  31. <a href="" class="item">视频教程</a>
  32. <a href="" class="item">学习路径</a>
  33. <a href="" class="item">php培训</a>
  34. <a href="" class="item">资源下载</a>
  35. <a href="" class="item">技术文章</a>
  36. <a href="" class="item">社区</a>
  37. <a href="" class="iconfont icon-shouji">app下载</a>
  38. <a href="" class="iconfont icon-gengduo gengduo"></a>
  39. </div>
  40. <div class="left">
  41. <input type="search" placeholder="请输入关键字搜索">
  42. <span class="iconfont icon-Magnifier fangdajing"></span>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="main">
  47. <div class="left-top">
  48. <a href="" class="item">php开发</a>
  49. <a href="" class="item">大前端</a>
  50. <a href="" class="item">后端开发</a>
  51. <a href="" class="item">数据库</a>
  52. <a href="" class="item">移动端</a>
  53. <a href="" class="item">运维开发</a>
  54. <a href="" class="item">UI设计</a>
  55. <a href="" class="item">计算机基础</a>
  56. </div>
  57. <div class="slider">
  58. <a href=""><img src="static/images/slider.jpeg" alt=""></a>
  59. </div>
  60. <div class="right-top">
  61. <div class="message">
  62. <a href=""><img src="static/images/wallhaven-j3dg1m.jpg" alt=""></a>
  63. <div class="user">
  64. <a href="">Jason</a>
  65. <br></br>
  66. <dd>P豆:9999</dd>
  67. </div>
  68. <a href="" class="mine">我的学习</a>
  69. </div>
  70. <div class="news">
  71. <p class="cont1">
  72. <span>社区问答</span>
  73. <a href="" class="red">答疑</a>
  74. </p>
  75. <p class="cont2">
  76. <span>头条</span><span class="cont">xxxx</span>
  77. </p>
  78. <p class="cont3">
  79. <span>新课</span><span class="cont">xxxx</span>
  80. </p>
  81. <p class="cont4">
  82. <span>新班</span><span class="cont">xxxx</span>
  83. </p>
  84. <p class="cont5">
  85. <span>招募</span><span class="cont">xxxx</span>
  86. </p>
  87. <p class="cont6">
  88. <span>公告</span><span class="cont">xxxx</span>
  89. </p>
  90. </div>
  91. </div>
  92. <div class="left-bottom">
  93. <div class="lesson">
  94. <span>学习路径</span>
  95. <em>全部7个&gt;</em>
  96. </div>
  97. <div class="outward">
  98. <div class="inside">
  99. <a href="" class="categlory">
  100. <img src="static/images/dgjj.png" alt="">
  101. <dl>
  102. <dt>独孤九贱</dt>
  103. <dd>9门课程</dd>
  104. </dl>
  105. </a>
  106. <a href="" class="categlory">
  107. <img src="static/images/ynxj.png" alt="">
  108. <dl>
  109. <dt>玉女心经</dt>
  110. <dd>5门课程</dd>
  111. </dl>
  112. </a>
  113. <a href="" class="categlory">
  114. <img src="static/images/tlbb.png" alt="">
  115. <dl>
  116. <dt>天龙八部</dt>
  117. <dd>3门课程</dd>
  118. </dl>
  119. </a>
  120. <a href="" class="categlory">
  121. <img src="static/images/phpkjkf.png" alt="">
  122. <dl>
  123. <dt>自学指南</dt>
  124. <dd>19门课程</dd>
  125. </dl>
  126. </a>
  127. <a href="" class="categlory">
  128. <img src="static/images/phpksrm.png" alt="">
  129. <dl>
  130. <dt>趣味闯关</dt>
  131. <dd>22门课程</dd>
  132. </dl>
  133. </a>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="right-bottom">
  138. <div>
  139. <a href="" class="iconfont icon-weixin"></a><h2>微信公众号</h2>
  140. </div>
  141. <div>
  142. <a href="" class="iconfont icon-QQ"></a><h2>官方QQ群</h2>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="more">
  147. <div class="zhiboke">
  148. <h2>直播课</h2>
  149. <a href="">更多&gt;</a>
  150. </div>
  151. <div class="zhiboke-detail">
  152. <a href="" class="zhibolesson"><img src="static/images/61a0ab3d9520d816.jpg" alt=""></a>
  153. <a href="" class="zhibolesson"><img src="static/images/6226d78b754aa110.png" alt=""></a>
  154. <a href="" class="zhibolesson"><img src="static/images/623bd189be2bd107.jpg" alt=""></a>
  155. <div class="left">
  156. <ul>
  157. <li>1 xxxx</li>
  158. <li>2 xxxx</li>
  159. <li>3 xxxx</li>
  160. <li>4 xxxx</li>
  161. <li>5 xxxx</li>
  162. <li>6 xxxx</li>
  163. </ul>
  164. </div>
  165. <a href="" class="one">直播课1</a>
  166. <a href="" class="one">直播课2</a>
  167. <a href="" class="one">直播课3</a>
  168. <div>
  169. <span style="margin-left: 10px;">精彩回放</span>
  170. <span style="color: #b7b7b7;margin-right: 10px;">99999人感兴趣</span>
  171. </div>
  172. <div>
  173. <span style="color: #f11717;margin-left: 10px;">精彩回放</span>
  174. <span style="color: #b7b7b7;margin-right: 10px;">99999人感兴趣</span>
  175. </div>
  176. <div>
  177. <span style="color: #f11717;margin-left: 10px;">即将开课</span>
  178. <span style="color: #b7b7b7;margin-right: 10px;">99999人感兴趣</span>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="lastest">
  183. <!-- <div class="lastest-nav"> -->
  184. <h2>最新课程</h2>
  185. <a href="">更多&gt;</a>
  186. <!-- </div> -->
  187. </div>
  188. <div class="latest-class">
  189. <div class="picture">
  190. <a href="">
  191. <img src="static\images\623d6ce036b81626.jpg" alt="">
  192. </a>
  193. <a href="" class="desc"><em>初级</em>Javascript基础语法</a>
  194. <div class="favor">
  195. <span>676次学习</span>
  196. <span>收藏</span>
  197. </div>
  198. </div>
  199. <div class="picture">
  200. <a href="">
  201. <img src="static\images\62398b673ecc4667.jpg" alt="">
  202. </a>
  203. <a href="" class="desc"><em>初级</em>前端最全http基础原理及运用 </a>
  204. <div class="favor">
  205. <span>676次学习</span>
  206. <span>收藏</span>
  207. </div>
  208. </div>
  209. <div class="picture">
  210. <a href="">
  211. <img src="static\images\62398b5dadc79937.jpg" alt="">
  212. </a>
  213. <a href="" class="desc"><em>初级</em>http协议</a>
  214. <div class="favor">
  215. <span>176次学习</span>
  216. <span>收藏</span>
  217. </div>
  218. </div>
  219. <div class="picture">
  220. <a href="">
  221. <img src="static\images\62381b3e817d4409.jpg" alt="">
  222. </a>
  223. <a href="" class="desc"><em>中级</em>API接口开发规范</a>
  224. <div class="favor">
  225. <span>982次学习</span>
  226. <span>收藏</span>
  227. </div>
  228. </div>
  229. <div class="picture">
  230. <a href="">
  231. <img src="static\images\623057031def7707.jpg" alt="">
  232. </a>
  233. <a href="" class="desc"><em>中级</em>MySQL查询优化方案</a>
  234. <div class="favor">
  235. <span>1379次学习</span>
  236. <span>收藏</span>
  237. </div>
  238. </div>
  239. <div class="picture">
  240. <a href="">
  241. <img src="static\images\622efba5b8f59620.jpg" alt="">
  242. </a>
  243. <a href="" class="desc"><em>中级</em>Web前端Promise教程从入门到精通</a>
  244. <div class="favor">
  245. <span>1342次学习</span>
  246. <span>收藏</span>
  247. </div>
  248. </div>
  249. <div class="picture">
  250. <a href="">
  251. <img src="static\images\622ee24c8180c270.jpg" alt="">
  252. </a>
  253. <a href="" class="desc"><em>初级</em>Bootstrap框架讲解</a>
  254. <div class="favor">
  255. <span>777次学习</span>
  256. <span>收藏</span>
  257. </div>
  258. </div>
  259. <div class="picture">
  260. <a href="">
  261. <img src="static\images\6226fe0150292919.jpg" alt="">
  262. </a>
  263. <a href="" class="desc"><em>初级</em>一周学会Linux</a>
  264. <div class="favor">
  265. <span>5671次学习</span>
  266. <span>收藏</span>
  267. </div>
  268. </div>
  269. <div class="picture">
  270. <a href="">
  271. <img src="static\images\6225aaf1beb5a942.jpg" alt="">
  272. </a>
  273. <a href="" class="desc"><em>中级</em>仿美团APP实战开发</a>
  274. <div class="favor">
  275. <span>1691次学习</span>
  276. <span>收藏</span>
  277. </div>
  278. </div>
  279. <div class="picture">
  280. <a href="">
  281. <img src="static\images\6226d78b754aa110.png" alt="">
  282. </a>
  283. <a href="" class="desc"><em>初级</em>PHP入门实战</a>
  284. <div class="favor">
  285. <span>1638次学习</span>
  286. <span>收藏</span>
  287. </div>
  288. </div>
  289. </div>
  290. </body>
  291. </html>

css

  • initial.css
  1. * {
  2. /* 页面初始化 */
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. /* a标签初始化 */
  8. a {
  9. text-decoration: none;
  10. /* 去掉下划线 */
  11. color: #555;
  12. }
  13. body {
  14. background-color: rgb(243,245,247);
  15. }
  16. li {
  17. list-style: none;
  18. /* 去掉无序列表前的小圆点 */
  19. }
  • top.css
  1. .header {
  2. width: 100vw;
  3. height: 40px;
  4. background-color: #343434;
  5. }
  6. .header .top .userimg img{
  7. width:70%;
  8. border-radius:200px;
  9. }
  10. .header .top {
  11. width: 1200px;
  12. height: 40px;
  13. display: grid;
  14. grid-template-columns: 400px 100px;
  15. margin: auto;
  16. grid-auto-rows: 40px;
  17. place-content: space-between;
  18. place-items: center start;
  19. }
  20. .header .top .title {
  21. color: #aaa;
  22. }
  23. .header .top .userimg {
  24. display: grid;
  25. grid-template-columns: repeat(2,1fr);
  26. place-content: space-between;
  27. place-items: center center;
  28. }
  29. .header .top .userimg .iconfont {
  30. font-size: larger;
  31. color: #eee;
  32. }
  33. .nav{
  34. width: 100vw;
  35. height: 90px;
  36. background-color: #fff;
  37. }
  38. .nav .content {
  39. width: 1200px;
  40. height: 90px;
  41. display: grid;
  42. grid-template-columns: 150px 1fr 220px;
  43. grid-auto-rows: 90px;
  44. margin: auto;
  45. place-content: space-between;
  46. place-items: center start;
  47. gap:20px
  48. }
  49. .nav .content .logo img {
  50. width: 100%;
  51. }
  52. .nav .content .meddle a:first-of-type,
  53. .nav .content .meddle a:hover{
  54. color: red;
  55. font-weight: bolder;
  56. }
  57. .nav .content .meddle {
  58. display: flex;
  59. place-content: space-between;
  60. position: relative;
  61. left: 20px;
  62. }
  63. .nav .content .meddle a{
  64. padding: 0 12px;
  65. font-size: large;
  66. }
  67. .nav .content .meddle .gengduo{
  68. font-size:x-large;
  69. font-weight: bolder;
  70. color: #000;
  71. }
  72. .nav .content .left{
  73. display: flex;
  74. place-content: space-between;
  75. place-items: center;
  76. }
  77. .nav .content .left input {
  78. width: 200px;
  79. height: 40px;
  80. border: none;
  81. outline: none;
  82. background-color: #f7f8fa;
  83. border-radius: 20px;
  84. padding-left: 20px;
  85. }
  86. .nav .content .left .fangdajing{
  87. font-size: larger;
  88. font-weight: bolder;
  89. color:#ccc;
  90. position: relative;
  91. left: -30px;
  92. }
  • main.css
  1. .main {
  2. font-size: 14px;
  3. display: grid;
  4. grid-template-columns: 160px 810px 190px;
  5. grid-template-rows: 400px 80px;
  6. gap:20px;
  7. place-content: center;
  8. margin: 30px 0;
  9. }
  10. .main .left-top{
  11. display: grid;
  12. /* grid-template-rows: repeat(8,1fr);
  13. background-color: #fff;
  14. border-radius: 10px; */
  15. place-items: center;
  16. padding:20px 0;
  17. background-color: #fff;
  18. border-radius: 20px;
  19. }
  20. .main .left-top a{
  21. border-radius: 20px;
  22. padding: 10px 20px;
  23. font-size: large;
  24. }
  25. .main .left-top a:hover{
  26. background-color: red;
  27. background-color: rgb(250, 223, 227);
  28. }
  29. .main .slider img{
  30. width: 100%;
  31. height: 400px;
  32. border-radius: 20px;
  33. vertical-align: top;
  34. }
  35. .main .right-top{
  36. /* background-color: #fff; */
  37. display: grid;
  38. grid-template-rows: 142px 1fr;
  39. gap:10px;
  40. /* place-content: space-between; */
  41. /* border-radius: 10px; */
  42. }
  43. .main .right-top .message img{
  44. width: 60%;
  45. border-radius:100%;
  46. margin-left: 18px;
  47. margin-top: 10px;
  48. }
  49. .main .right-top .message {
  50. display: grid;
  51. grid-template-rows: repeat(2,1fr);
  52. grid-template-columns: repeat(2,1fr);
  53. place-content: center;
  54. place-items: center center;
  55. background-color: #fff;
  56. border-radius: 10px;
  57. }
  58. .main .right-top .user{
  59. place-self: center start;
  60. }
  61. .main .right-top .user a{
  62. font-size: large;
  63. font-weight: bold;
  64. }
  65. .main .right-top .user a:hover{
  66. color: #f11717;
  67. }
  68. .main .right-top .user dd{
  69. font-size:14px;
  70. color: #d0d0df;
  71. }
  72. .main .right-top .message .mine{
  73. grid-column: span 2;
  74. background-color:#f11717;
  75. width: 150px;
  76. height: 30px;
  77. border-radius: 20px;
  78. padding: auto;
  79. text-align: center;
  80. font-size: large;
  81. font-weight: bold;
  82. color: #fff;
  83. }
  84. .main .right-top .news{
  85. font-size: 15px;
  86. display: grid;
  87. grid-template-rows: repeat(6,1fr);
  88. background-color: #fff;
  89. border-radius: 20px;
  90. }
  91. .main .right-top .news p{
  92. margin-left: 20px;
  93. }
  94. .main .right-top .news .cont1{
  95. margin-top: 10px;
  96. }
  97. .main .right-top .news .cont1 .red{
  98. background-color: red;
  99. color: #fff;
  100. }
  101. .main .right-top .news .cont{
  102. margin-left: 20px;
  103. color: #d0d0df;
  104. }
  105. .main .left-bottom {
  106. grid-column: span 2;
  107. display:grid;
  108. grid-template-columns: 100px 1fr;
  109. background-color: #fff;
  110. border-radius: 20px;
  111. }
  112. .main .left-bottom .lesson{
  113. display: grid;
  114. place-items: center;
  115. padding: 16px;
  116. border-radius: 20px;
  117. }
  118. .main .left-bottom .outward .inside .categlory img{
  119. width: 36px;
  120. height: 36px;
  121. }
  122. .main .left-bottom .outward .inside{
  123. display: flex;
  124. place-items: center;
  125. place-content: space-between;
  126. }
  127. .main .left-bottom .outward .inside .categlory{
  128. display: grid;
  129. grid-template-columns: repeat(2,1fr);
  130. place-content: center;
  131. place-items: center;
  132. margin: 23px;
  133. }
  134. .main .right-bottom{
  135. display: grid;
  136. grid-template-columns: repeat(2,1fr);
  137. background:#fff;
  138. border-radius: 20px;
  139. gap:10px;
  140. place-content: space-between;
  141. place-items: center;
  142. padding: 12px;
  143. }
  144. .main .right-bottom .iconfont{
  145. font-size: 40px;
  146. border-radius: 100%;
  147. margin: 10px;
  148. color: #fff;
  149. background: #d0d0d0;
  150. }
  151. .main .right-bottom h2{
  152. font-size: 12px;
  153. }
  154. .more .zhiboke {
  155. width: 1200px;
  156. height: 32px;
  157. display: flex;
  158. place-content: space-between;
  159. margin:auto;
  160. }
  161. .more .zhiboke h2{
  162. font: 22px;
  163. color: #333;
  164. }
  165. .more .zhiboke a{
  166. font:14px;
  167. width: 78px;
  168. height: 32px;
  169. color: #999;
  170. background-color: rgb(240,241,244);
  171. border-radius: 20px;
  172. text-align: center;
  173. padding-top: 10px;
  174. }
  175. .more .zhiboke-detail{
  176. width: 1200px;
  177. height: 275px;
  178. display: grid;
  179. grid-template-columns: repeat(4,280px);
  180. grid-template-rows: 200px 50px 25px;
  181. column-gap:26px;
  182. place-content: center;
  183. margin: auto;
  184. margin-top: 30px;
  185. }
  186. .more .zhiboke-detail img{
  187. width: 100%;
  188. height: 100%;
  189. /* border-radius: 20px; */
  190. /* position: relative;
  191. left: 14px;
  192. top:10px; */
  193. }
  194. .more .zhiboke-detail .left{
  195. grid-row: span 3;
  196. }
  197. .more .zhiboke-detail .zhibolesson{
  198. background-color: #fff;
  199. /* border-radius: 20px 20px 0 0; */
  200. }
  201. .more .zhiboke-detail .one {
  202. background-color: #fff;
  203. font-size: 16px;
  204. padding: 10px 10px
  205. }
  206. .more .zhiboke-detail .one:hover{
  207. color: #f11717;
  208. }
  209. .more .zhiboke-detail div{
  210. background-color: #fff;
  211. /* border-radius:0 0 20px 20px; */
  212. display: flex;
  213. place-content: space-between;
  214. font-size: 14px;
  215. color: #666;
  216. }
  217. .more .zhiboke-detail .left{
  218. border-radius: 20px;
  219. }
  220. .more .zhiboke-detail .left li{
  221. margin: 24px;
  222. margin-left: 40px;
  223. list-style: disc;
  224. }
  • latest.css
  1. .lastest{
  2. width: 1200px;
  3. height: 32px;
  4. display: flex;
  5. place-content: space-between;
  6. margin: auto;
  7. margin-top: 40px;
  8. }
  9. .lastest h2{
  10. font: 22px;
  11. color: #333;
  12. }
  13. .lastest a{
  14. font: 14px;
  15. width: 78px;
  16. height: 32px;
  17. color: #999;
  18. background-color: rgb(240,241,244);
  19. border-radius: 20px;
  20. text-align: center;
  21. padding-top: 10px;
  22. }
  23. .latest-class {
  24. width: 1200px;
  25. height: 530px;
  26. margin: auto;
  27. margin-top: 30px;
  28. display: grid;
  29. grid-template-columns: repeat(5,223px);
  30. grid-template-rows: repeat(2,235px);
  31. gap: 20px;
  32. }
  33. .latest-class .picture img{
  34. width: 100%;
  35. height: 100%;
  36. border-radius: 10px 10px 0 0;
  37. }
  38. .latest-class .picture{
  39. display: grid;
  40. grid-template-rows: 130px 40px 15px;
  41. background-color: #fff;
  42. border-radius: 10px;
  43. }
  44. .latest-class .picture .desc {
  45. margin: 20px 10px;
  46. font-size: normal;
  47. }
  48. .latest-class .picture em {
  49. font-size: 10px;
  50. background-color: gray;
  51. margin-right: 8px;
  52. color: white;
  53. padding: 3px
  54. }
  55. .latest-class .picture .favor{
  56. margin-top: 30px;
  57. display: flex;
  58. place-content: space-between;
  59. padding: 0 10px 0 10px;
  60. font-size: small;
  61. color:gray;
  62. }

效果展示:



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