Blogger Information
Blog 9
fans 0
comment 0
visits 5615
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
模仿PHP中文网首页
Original
265 people have browsed it

模仿PHP中文网首页

html代码

  1. <!DOCTYPE html>
  2. <html lang="zh_cn">
  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="https://at.alicdn.com/t/font_3205780_7eqow85axa.css">
  8. <link rel="stylesheet" href="static/style/top.css">
  9. <link rel="stylesheet" href="static/style/main.css">
  10. <title>php中文网</title>
  11. </head>
  12. <body>
  13. <!-- 页眉 -->
  14. <header>
  15. <!-- 顶部 -->
  16. <div class="top">
  17. <!-- 左侧 -->
  18. <div class="neirong">
  19. <div class="wenzi">php中文网,程序员梦开始的地方!</div>
  20. <!-- 右侧用户 -->
  21. <div class="you">
  22. <a class="iconfont icon-tixingtianchong" href=""></a>
  23. <a class="touxiang" href=""><img src="static/images/user-pic.jpeg" alt=""></a>
  24. </div>
  25. </div>
  26. </div>
  27. <!-- 导航 -->
  28. <div class="navs">
  29. <div class="content">
  30. <a href="" class="logo"><img src="static/images/logo.png" alt=""></a>
  31. <nav>
  32. <a href="" class="active">首页</a>
  33. <a href="">视频教程</a>
  34. <a href="">学习路径</a>
  35. <a href="">PHP培训</a>
  36. <a href="">资源下载</a>
  37. </nav>
  38. <div class="search">
  39. <input type="search" placeholder="请输入搜索内容!" />
  40. <span class="iconfont icon-fangdajing1"></span>
  41. </div>
  42. </div>
  43. </div>
  44. </header>
  45. <!-- 内容 -->
  46. <main>
  47. <div class="navs">
  48. <div class="left">
  49. <a href="">php开发</a>
  50. <a href="">大前端</a>
  51. <a href="">后端开发</a>
  52. <a href="">数据库</a>
  53. <a href="">移动端</a>
  54. <a href="">运维开发</a>
  55. <a href="">UI设计</a>
  56. <a href="">计算机基础</a>
  57. </div>
  58. <div class="slider">
  59. <a href=""><img src="static/images/slider.jpeg" alt="" /></a>
  60. </div>
  61. <div class="right">
  62. <div class="righttop">
  63. <div class="touxiang"><a href=""><img src="static/images/user-pic.jpeg" alt=""></a></div>
  64. <span><a href="" class="name"></a><p>p豆 16</p></span>
  65. <button class="xuexi">我的学习</button>
  66. </div>
  67. <div class="fengexian"></div>
  68. <div class="rightfoot">
  69. <p class="xinxi1">
  70. <span>答问社区</span>
  71. <a href="">答疑</a>
  72. </p>
  73. <p class="xinxi2">
  74. <span>头条</span>
  75. <a href="">今日头条</a>
  76. </p>
  77. <p class="xinxi3">
  78. <span>福利</span>
  79. <a href="">限时折扣>></a>
  80. </p>
  81. <p class="xinxi4">
  82. <span>新班</span>
  83. <a href="">20期PHP线上班</a>
  84. </p>
  85. <p class="xinxi5">
  86. <span>招募</span>
  87. <a href="">课程合作计划</a>
  88. </p>
  89. <p class="xinxi6">
  90. <span>公告</span>
  91. <a href="">APP上线啦</a>
  92. </p>
  93. </div>
  94. </div>
  95. <div class="bottom-left">
  96. <div class="desc">
  97. <div class="title">学习路径</div>
  98. <span>全部7个&gt;</span>
  99. </div>
  100. <ul class="detail">
  101. <li onclick="">
  102. <img src="static/images/dgjj.png" alt="" />
  103. <a href="">独孤九贱</a>
  104. <span>9门课程</span>
  105. </li>
  106. <li onclick="">
  107. <img src="static/images/ynxj.png" alt="" />
  108. <a href="">独孤九贱</a>
  109. <span>9门课程</span>
  110. </li>
  111. <li onclick="">
  112. <img src="static/images/tlbb.png" alt="" />
  113. <a href="">独孤九贱</a>
  114. <span>9门课程</span>
  115. </li>
  116. <li onclick="">
  117. <img src="static/images/phpkjkf.png" alt="" />
  118. <a href="">独孤九贱</a>
  119. <span>9门课程</span>
  120. </li>
  121. <li onclick="">
  122. <img src="static/images/phpksrm.png" alt="" />
  123. <a href="">独孤九贱</a>
  124. <span>9门课程</span>
  125. </li>
  126. </ul>
  127. </div>
  128. <div class="bottom-right">
  129. <div class="weixin">
  130. <text class="iconfont icon-weixin-copy"></text>
  131. <h4>官方公众号</h4>
  132. </div>
  133. <div class="qq">
  134. <text class="iconfont icon-QQ-circle-fill"></text>
  135. <h4>官方QQ群</h4>
  136. </div>
  137. </div>
  138. </div>
  139. </main>
  140. </body>
  141. </html>

1.1css代码re.css

  1. * {
  2. padding: 0;
  3. margin: 0;
  4. box-sizing: border-box;
  5. }
  6. a {
  7. text-decoration: none;
  8. color: #555;
  9. }
  10. body {
  11. background-color: rgb(243, 245, 247);
  12. }
  13. li {
  14. list-style: none;
  15. }

1.2css代码top.css

  1. @import url(re.css);
  2. header .top {
  3. width: 100vw;
  4. height: 40px;
  5. background-color: #343434;
  6. color: white;
  7. }
  8. header .top .neirong {
  9. width: 1200px;
  10. display: grid;
  11. grid-template-columns: 400px 100px;
  12. grid-auto-rows: 40px;
  13. place-content: space-between;
  14. place-items: center start;
  15. margin: auto;
  16. }
  17. header .top .neirong a {
  18. color: white;
  19. }
  20. header .top .neirong img {
  21. width: 50%;
  22. border-radius: 50%;
  23. }
  24. header .top .neirong .you {
  25. display: grid;
  26. grid-template-columns: repeat(2, 1fr);
  27. place-items: center;
  28. }
  29. header .top .neirong .you .iconfont {
  30. font-size: larger;
  31. }
  32. /* 导航 */
  33. header .navs {
  34. width: 100vw;
  35. height: 90px;
  36. background-color: white;
  37. box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  38. }
  39. header .navs .content {
  40. width: 1200px;
  41. display: grid;
  42. grid-template-columns: 140px 1fr 200px;
  43. grid-auto-rows: 90px;
  44. place-items: center start;
  45. margin: auto;
  46. gap: 10px;
  47. }
  48. header .navs .content nav {
  49. display: flex;
  50. }
  51. header .navs .content nav a {
  52. padding: 0 10px;
  53. }
  54. header .navs .content nav a:hover,
  55. header .navs .content nav a.active {
  56. font-size: bold;
  57. color: red;
  58. }
  59. header .navs .content a img {
  60. width: 100%;
  61. }
  62. header .navs .content .search {
  63. display: flex;
  64. }
  65. header .navs .content .search input[type='search'] {
  66. border: none;
  67. background-color: #eee;
  68. width: 200px;
  69. height: 36px;
  70. outline: none;
  71. border-radius: 20px;
  72. padding-left: 10px;
  73. }
  74. header .navs .content .search .iconfont {
  75. position: relative;
  76. font-size: 22px;
  77. left: -40px;
  78. top: 6px;
  79. color: #ccc;
  80. }
  81. header .navs .content .search .iconfont:hover {
  82. cursor: pointer;
  83. color: red;
  84. }

1.3css代码main.css

  1. @import url(font_icon/iconfont.css);
  2. main {
  3. font-size: 14px;
  4. }
  5. main .navs {
  6. display: grid;
  7. grid-template-rows: 400px 80px;
  8. grid-template-columns: 160px 810px 190px;
  9. gap: 20px;
  10. place-content: center;
  11. margin: 30px 0;
  12. }
  13. /* 统一样式 */
  14. main .navs > * {
  15. background-color: white;
  16. border-radius: 20px;
  17. }
  18. main .navs .bottom-left {
  19. grid-column: span 2;
  20. }
  21. main .navs .left {
  22. padding: 20px 0;
  23. display: grid;
  24. place-items: center;
  25. }
  26. main .navs .left a {
  27. padding: 10px 20px;
  28. width: 120px;
  29. text-align: center;
  30. }
  31. main .navs .left a:hover {
  32. color: red;
  33. border-radius: 20px;
  34. background-color: rgb(250, 223, 227);
  35. }
  36. main .navs .slider img {
  37. width: 100%;
  38. border-radius: 20px;
  39. }
  40. main .navs .bottom-left {
  41. display: grid;
  42. grid-template-columns: 100px 1fr;
  43. }
  44. main .navs .bottom-left .detail img {
  45. width: 100%;
  46. grid-row: span 2;
  47. }
  48. main .navs .bottom-left .detail li {
  49. display: grid;
  50. grid-template-columns: 36px 85px;
  51. gap: 3px;
  52. /* grid-template-columns: repeat(2,36); */
  53. }
  54. main .navs .bottom-left .detail a:hover {
  55. color: #ff583d;
  56. }
  57. main .navs .bottom-left .detail span {
  58. color: #b6b6b6;
  59. font-size: 12px;
  60. }
  61. main .navs .bottom-left .detail a {
  62. color: black;
  63. }
  64. main .navs .bottom-left .desc span {
  65. color: #b6b6b6;
  66. font-size: 12px;
  67. }
  68. main .navs .bottom-left .detail {
  69. display: flex;
  70. place-items: center;
  71. place-content: space-between;
  72. }
  73. main .navs .bottom-left .desc {
  74. padding: 16px 0;
  75. display: grid;
  76. place-items: center;
  77. }
  78. /* 作业部分 */
  79. main .navs .right {
  80. display: grid;
  81. grid-template-rows: 142px 1fr 240px;
  82. }
  83. main .navs .right .righttop {
  84. display: grid;
  85. grid-template-rows: 80px 34px ;
  86. grid-template-columns: 40px 150px;
  87. margin: 0 20px;
  88. place-items:center start;
  89. gap: 10px;
  90. }
  91. main .navs .right .righttop .touxiang img{
  92. width: 100%;
  93. border-radius: 50%;
  94. }
  95. main .navs .right .righttop .xuexi {
  96. width: 150px;
  97. height: 34px;
  98. border: none;
  99. background-color: red;
  100. color: white;
  101. border-radius: 20px;
  102. }
  103. main .navs .right .righttop .xuexi:hover {
  104. cursor: pointer;
  105. background-color: rgb(231, 0, 0);
  106. }
  107. main .navs .right .rightfoot {
  108. display: grid;
  109. grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr;
  110. place-items: center start;
  111. margin: 0 20px;
  112. }
  113. main .navs .right .rightfoot p {
  114. display: grid;
  115. grid-template-columns: 1fr 100px;
  116. place-items: center start;
  117. gap: 10px;
  118. margin: 0 10px 0 0;
  119. }
  120. main .navs .right .fengexian {
  121. width: 190px;
  122. height: 1px;
  123. background-color: #eee;
  124. }
  125. main .navs .right .rightfoot .xinxi1 a{
  126. width: 31px;
  127. height: 16px;
  128. background-color: #ff583d;
  129. color: white;
  130. font-size: 14px;
  131. text-align: center;
  132. line-height: 16px;
  133. border-radius: 3px;
  134. }
  135. main .navs .right .rightfoot>span {
  136. font-size: bold;
  137. }
  138. main .navs .right .rightfoot a {
  139. color: #b6b6b6;
  140. }
  141. main .navs .right .righttop .name {
  142. font-size: 16px;
  143. font-size: bold;
  144. color: black;
  145. }
  146. main .navs .right .righttop p {
  147. color: #b6b6b6;
  148. }
  149. /* 联系方式 */
  150. main .navs .bottom-right {
  151. display: grid;
  152. grid-template-columns: 95px 95px;
  153. place-items: center;
  154. }
  155. main .navs .bottom-right .weixin,
  156. main .navs .bottom-right .qq {
  157. display: grid;
  158. grid-template-rows: 1fr 1fr;
  159. place-items: center;
  160. }
  161. main .navs .bottom-right .weixin .iconfont,
  162. main .navs .bottom-right .qq .iconfont {
  163. font-size: 30px;
  164. color: #b6b6b6;
  165. }
  166. main .navs .bottom-right .weixin h4,
  167. main .navs .bottom-right .qq h4 {
  168. font-size: 13px;
  169. }
  170. main .navs .bottom-right .weixin:hover,
  171. main .navs .bottom-right .qq:hover {
  172. cursor: pointer;
  173. color: #ff583d;
  174. }

效果截图演示

image-20220718192902272

image-20220718192941024

image-20220718192956363

image-20220718193016895

Correcting teacher:PHPzPHPz

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