ASCII码 ASCII码

布局实战小结

发布于:2022-03-27 10:55:50  栏目:技术文档

仿写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="//at.alicdn.com/t/font_3279636_17208zykr8dj.css">
  11. <title>php中文网</title>
  12. </head>
  13. <body>
  14. <div class="header">
  15. <div class="top">
  16. <div class="title">
  17. <span>php中文网-程序员梦开始的地方</span>
  18. </div>
  19. <div class="userimg">
  20. <a href="" class="iconfont icon-lingdang-xianxing"></a>
  21. <a href=""><img src="static/images/wallhaven-j3dg1m.jpg" alt=""></a>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="nav">
  26. <div class="content">
  27. <a href="" class="logo"><img src="static/images/logo.png" alt=""></a>
  28. <div class="meddle">
  29. <a href="" class="item">首页</a>
  30. <a href="" class="item">视频教程</a>
  31. <a href="" class="item">学习路径</a>
  32. <a href="" class="item">php培训</a>
  33. <a href="" class="item">资源下载</a>
  34. <a href="" class="item">技术文章</a>
  35. <a href="" class="item">社区</a>
  36. <a href="" class="iconfont icon-shouji">app下载</a>
  37. <a href="" class="iconfont icon-gengduo gengduo"></a>
  38. </div>
  39. <div class="left">
  40. <input type="search" placeholder="请输入关键字搜索">
  41. <span class="iconfont icon-Magnifier fangdajing"></span>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="main">
  46. <div class="left-top">
  47. <a href="" class="item">php开发</a>
  48. <a href="" class="item">大前端</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">UI设计</a>
  54. <a href="" class="item">计算机基础</a>
  55. </div>
  56. <div class="slider">
  57. <a href=""><img src="static/images/slider.jpeg" alt=""></a>
  58. </div>
  59. <div class="right-top">
  60. <div class="message">
  61. <a href=""><img src="static/images/wallhaven-j3dg1m.jpg" alt=""></a>
  62. <div class="user">
  63. <a href="">Jason</a>
  64. <br></br>
  65. <dd>P豆:9999</dd>
  66. </div>
  67. <a href="" class="mine">我的学习</a>
  68. </div>
  69. <div class="news">
  70. <p class="cont1">
  71. <span>社区问答</span>
  72. <a href="" class="red">答疑</a>
  73. </p>
  74. <p class="cont2">
  75. <span>头条</span><span class="cont">xxxx</span>
  76. </p>
  77. <p class="cont3">
  78. <span>新课</span><span class="cont">xxxx</span>
  79. </p>
  80. <p class="cont4">
  81. <span>新班</span><span class="cont">xxxx</span>
  82. </p>
  83. <p class="cont5">
  84. <span>招募</span><span class="cont">xxxx</span>
  85. </p>
  86. <p class="cont6">
  87. <span>公告</span><span class="cont">xxxx</span>
  88. </p>
  89. </div>
  90. </div>
  91. <div class="left-bottom">
  92. <div class="lesson">
  93. <span>学习路径</span>
  94. <em>全部7个&gt;</em>
  95. </div>
  96. <div class="outward">
  97. <div class="inside">
  98. <a href="" class="categlory">
  99. <img src="static/images/dgjj.png" alt="">
  100. <dl>
  101. <dt>独孤九贱</dt>
  102. <dd>9门课程</dd>
  103. </dl>
  104. </a>
  105. <a href="" class="categlory">
  106. <img src="static/images/ynxj.png" alt="">
  107. <dl>
  108. <dt>玉女心经</dt>
  109. <dd>5门课程</dd>
  110. </dl>
  111. </a>
  112. <a href="" class="categlory">
  113. <img src="static/images/tlbb.png" alt="">
  114. <dl>
  115. <dt>天龙八部</dt>
  116. <dd>3门课程</dd>
  117. </dl>
  118. </a>
  119. <a href="" class="categlory">
  120. <img src="static/images/phpkjkf.png" alt="">
  121. <dl>
  122. <dt>自学指南</dt>
  123. <dd>19门课程</dd>
  124. </dl>
  125. </a>
  126. <a href="" class="categlory">
  127. <img src="static/images/phpksrm.png" alt="">
  128. <dl>
  129. <dt>趣味闯关</dt>
  130. <dd>22门课程</dd>
  131. </dl>
  132. </a>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="right-bottom">
  137. <div>
  138. <a href="" class="iconfont icon-weixin"></a><h2>微信公众号</h2>
  139. </div>
  140. <div>
  141. <a href="" class="iconfont icon-QQ"></a><h2>官方QQ群</h2>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="more">
  146. <div class="zhiboke">
  147. <h2>直播课</h2>
  148. <a href="">更多&gt;</a>
  149. </div>
  150. <div class="zhiboke-detail">
  151. <a href="" class="zhibolesson"><img src="static/images/61a0ab3d9520d816.jpg" alt=""></a>
  152. <a href="" class="zhibolesson"><img src="static/images/6226d78b754aa110.png" alt=""></a>
  153. <a href="" class="zhibolesson"><img src="static/images/623bd189be2bd107.jpg" alt=""></a>
  154. <div class="left">
  155. <ul>
  156. <li>1 xxxx</li>
  157. <li>2 xxxx</li>
  158. <li>3 xxxx</li>
  159. <li>4 xxxx</li>
  160. <li>5 xxxx</li>
  161. <li>6 xxxx</li>
  162. </ul>
  163. </div>
  164. <a href="" class="one">直播课1</a>
  165. <a href="" class="one">直播课2</a>
  166. <a href="" class="one">直播课3</a>
  167. <div>
  168. <span style="margin-left: 10px;">精彩回放</span>
  169. <span style="color: #b7b7b7;margin-right: 10px;">99999人感兴趣</span>
  170. </div>
  171. <div>
  172. <span style="color: #f11717;margin-left: 10px;">精彩回放</span>
  173. <span style="color: #b7b7b7;margin-right: 10px;">99999人感兴趣</span>
  174. </div>
  175. <div>
  176. <span style="color: #f11717;margin-left: 10px;">即将开课</span>
  177. <span style="color: #b7b7b7;margin-right: 10px;">99999人感兴趣</span>
  178. </div>
  179. </div>
  180. </div>
  181. </body>
  182. </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. }

效果展示:

相关推荐
阅读 +