博客列表 >仿 php.cn 中文网首页

仿 php.cn 中文网首页

。。。
。。。原创
2022年03月27日 17:20:56383浏览

仿 php.cn 中文网首页

  • 效果演示
    效果演示1

  • 语法

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="static/css/reset.css" />
  8. <link rel="stylesheet" href="static/images/iconfont.css" />
  9. <link rel="stylesheet" href="static/css/header.css" />
  10. <link rel="stylesheet" href="static/css/main-nav.css" />
  11. <title>仿php.cn中文网首页</title>
  12. </head>
  13. <body>
  14. <header>
  15. <div class="top">
  16. <div class="content">
  17. <div class="title">php中文网,程序员梦开始的地方!</div>
  18. <div class="right">
  19. <a href="" class="iconfont icon-icon_notice"><span>2</span></a>
  20. <a href=""><img src="static/images/heard-img.jpeg" alt="" /></a>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="navs">
  25. <div class="content">
  26. <a href="" class="logo"
  27. ><img src="static/images/logo.png" alt=""
  28. /></a>
  29. <nav>
  30. <a href="" class="active">首页</a>
  31. <a href="">视频教程<b class="iconfont icon-xiala xiala"></b></a>
  32. <a href="">学习路径<b class="iconfont icon-xiala xiala"></b></a>
  33. <a href="">php培训<span></span></a>
  34. <a href="">资源下载<b class="iconfont icon-xiala xiala"></b></a>
  35. <a href="">技术文章<b class="iconfont icon-xiala xiala"></b></a>
  36. <a href="">社区 <b class="iconfont icon-xiala xiala"></b></a>
  37. <a href=""
  38. ><b class="iconfont icon-shumashouji shouji"></b>APP下载</a
  39. >
  40. <a href=""><b>...</b></a>
  41. </nav>
  42. <div class="search">
  43. <input type="search" placeholder="输入关键字搜索" />
  44. <span class="iconfont icon-sousuo"></span>
  45. </div>
  46. </div>
  47. </div>
  48. </header>
  49. <main>
  50. <div class="navs">
  51. <!-- 2行3列 -->
  52. <div class="left">
  53. <a href="">php开发</a>
  54. <a href="">大前端</a>
  55. <a href="">后端开发</a>
  56. <a href="">数据库</a>
  57. <a href="">移动端</a>
  58. <a href="">运维开发</a>
  59. <a href="">UI设计</a>
  60. <a href="">计算机基础</a>
  61. </div>
  62. <div class="slider">
  63. <a href="">
  64. <img src="static/images/slider.jpeg" alt="" />
  65. </a>
  66. </div>
  67. <div class="right">
  68. <div class="right-top">
  69. <div class="right-top-content">
  70. <img src="static/images/heard-img.jpeg" alt="" />
  71. <dl>
  72. <dt>
  73. <a href="">。。。</a>
  74. </dt>
  75. <dd>P豆 12</dd>
  76. </dl>
  77. </div>
  78. <div class="right-top-button">
  79. <button>我的学习</button>
  80. </div>
  81. </div>
  82. <div class="right-bottom">
  83. <div class="right-bottom-content">
  84. <div class="right-bottom-content-top">
  85. <span>问答社区</span>
  86. <a href="">答疑</a>
  87. </div>
  88. <div class="right-bottom-content-list">
  89. <div>
  90. <span>头条</span>
  91. <a href="">首个采用中文编写的操作系统出现了!</a>
  92. </div>
  93. <div><span>新课</span> <a href="">3.9号公益直播课</a></div>
  94. <div><span>新班</span> <a href="">19期PHP直播班</a></div>
  95. <div><span>招募</span> <a href="">课程合作计划</a></div>
  96. <div><span>公告</span> <a href="">APP上线啦</a></div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="bottom-left">
  102. <!-- 学习路径 -->
  103. <div class="desc">
  104. <div class="title">学习路径</div>
  105. <span>全部7个&gt;</span>
  106. </div>
  107. <ul class="detail">
  108. <li onclick="">
  109. <img src="static/images//dgjj.png" alt="" />
  110. <a href="">独孤九贱</a>
  111. <span>9门课程</span>
  112. </li>
  113. <li onclick="">
  114. <img src="static/images//ynxj.png" alt="" />
  115. <a href="">独孤九贱</a>
  116. <span>9门课程</span>
  117. </li>
  118. <li onclick="">
  119. <img src="static/images//phpkjkf.png" alt="" />
  120. <a href="">独孤九贱</a>
  121. <span>9门课程</span>
  122. </li>
  123. <li onclick="">
  124. <img src="static/images//phpksrm.png" alt="" />
  125. <a href="">趣味闯关</a>
  126. <span>9门课程</span>
  127. </li>
  128. <li onclick="">
  129. <img src="static/images//dgjj.png" alt="" />
  130. <a href="">独孤九贱</a>
  131. <span>9门课程</span>
  132. </li>
  133. </ul>
  134. </div>
  135. <div class="bottom-right">
  136. <div class="bottom-right-weixin">
  137. <span class="iconfont icon-weixin"></span>
  138. <a href=""> 官方公众号</a>
  139. </div>
  140. <div class="bottom-right-qq">
  141. <span class="iconfont icon-qq"></span>
  142. <a href=""> 官方QQ群</a>
  143. </div>
  144. </div>
  145. </div>
  146. </main>
  147. </body>
  148. </html>

reset.css

  1. * {
  2. margin: 0;
  3. padding: 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. }

header.css

  1. header .top {
  2. width: 100vw;
  3. height: 40px;
  4. background-color: rgb(52, 52, 52);
  5. color: #aaa;
  6. }
  7. header .top .content img {
  8. width: 50%;
  9. border-radius: 50%;
  10. }
  11. header .top .content {
  12. width: 1200px;
  13. display: grid;
  14. grid-template-columns: 400px 100px;
  15. grid-auto-rows: 40px;
  16. place-content: space-between;
  17. place-items: center start;
  18. margin: auto;
  19. }
  20. header .top .content .right .iconfont {
  21. color: #eee;
  22. font-size: larger;
  23. position: relative;
  24. }
  25. .right > a > span {
  26. height: 15px;
  27. padding: 0px 4px;
  28. background: #f11717;
  29. border-radius: 100px;
  30. color: #ffffff;
  31. font-size: 12px;
  32. line-height: 15px;
  33. position: absolute;
  34. left: 12px;
  35. top: -9px;
  36. }
  37. header .top .content .right {
  38. display: grid;
  39. grid-template-columns: repeat(2, 1fr);
  40. place-items: center;
  41. }
  42. /* 导航 */
  43. header .navs {
  44. width: 100vw;
  45. height: 90px;
  46. background-color: #fff;
  47. }
  48. header .navs .content {
  49. width: 1200px;
  50. /* border: 1px solid #000; */
  51. display: grid;
  52. grid-template-columns: 140px 1fr 200px;
  53. grid-auto-rows: 90px;
  54. gap: 10px;
  55. margin: auto;
  56. place-items: center start;
  57. }
  58. header .navs .content img {
  59. width: 100%;
  60. }
  61. header .navs .content nav a.active,
  62. header .navs .content nav a:hover {
  63. color: red;
  64. font-weight: bold;
  65. }
  66. header .navs .content .search {
  67. display: flex;
  68. }
  69. header .navs .content nav a {
  70. padding: 0 10px;
  71. height: 2em;
  72. }
  73. header .navs .content .search input[type="search"] {
  74. width: 200px;
  75. height: 36px;
  76. border: none;
  77. outline: none;
  78. background-color: #f7f8fa;
  79. border-radius: 20px;
  80. padding-left: 10px;
  81. }
  82. header .navs .content .search > span {
  83. font-size: 22px;
  84. color: #ccc;
  85. position: relative;
  86. left: -40px;
  87. top: 5px;
  88. }
  89. header .navs .content .search > span:hover {
  90. color: red;
  91. font-weight: bold;
  92. }
  93. header .navs .content nav a > b {
  94. font-size: 2em;
  95. line-height: 0px;
  96. }
  97. header .navs .content nav a .shouji {
  98. font-size: 20px;
  99. color: red;
  100. }
  101. header .navs .content nav > a:nth-of-type(8) {
  102. color: red;
  103. }
  104. header .navs .content nav a:hover {
  105. color: red;
  106. font-weight: normal;
  107. }
  108. header .navs .content nav a .xiala {
  109. font-size: small;
  110. margin-bottom: 5px;
  111. margin-left: 5px;
  112. }
  113. header .navs .content nav a > span {
  114. height: 15px;
  115. padding: 0px 4px;
  116. background: #f11717;
  117. border-radius: 100px;
  118. color: #ffffff;
  119. font-size: 12px;
  120. line-height: 15px;
  121. position: relative;
  122. left: 0px;
  123. top: -9px;
  124. }

main-nav.css

  1. main {
  2. font-size: 14px;
  3. }
  4. main .navs {
  5. /* 2行3列 */
  6. display: grid;
  7. grid-template-columns: 160px 810px 190px;
  8. grid-template-rows: 400px 80px;
  9. gap: 20px;
  10. place-content: center;
  11. margin: 30px 0;
  12. }
  13. main .navs > * {
  14. background-color: #fff;
  15. border-radius: 20px;
  16. /* outline: 1px solid red; */
  17. }
  18. /* 底部左侧占2列 */
  19. main .navs .bottom-left {
  20. grid-column: span 2;
  21. }
  22. main .navs .slider img {
  23. width: 100%;
  24. border-radius: 20px;
  25. }
  26. /* 左侧导航 */
  27. main .navs .left {
  28. display: grid;
  29. place-items: center;
  30. padding: 20px 0;
  31. }
  32. main .navs .left a:hover {
  33. color: red;
  34. background-color: rgb(250, 223, 227);
  35. }
  36. main .navs .left a {
  37. border-radius: 20px;
  38. padding: 10px 20px;
  39. }
  40. /* 底部左侧 */
  41. main .navs .bottom-left {
  42. display: grid;
  43. grid-template-columns: 100px 1fr;
  44. }
  45. main .navs .bottom-left .desc {
  46. display: grid;
  47. place-items: center;
  48. padding: 16px;
  49. }
  50. main .navs .bottom-left .detail img {
  51. width: 100%;
  52. grid-row: span 2;
  53. }
  54. main .navs .bottom-left .detail {
  55. display: flex;
  56. place-items: center;
  57. place-content: space-between;
  58. }
  59. main .navs .bottom-left .detail li {
  60. display: grid;
  61. grid-template-columns: 36px 85px;
  62. gap: 0 10px;
  63. place-items: center start;
  64. }
  65. main .navs .bottom-left .detail li a {
  66. font-size: 14px;
  67. }
  68. main .navs .bottom-left .detail li a:hover {
  69. color: red;
  70. }
  71. main .navs .bottom-left .detail li span,
  72. main .navs .bottom-left .desc span {
  73. font-size: 12px;
  74. color: #999;
  75. }
  76. /* 右侧侧导航 */
  77. main .right {
  78. display: grid;
  79. grid-template-rows: 142px 1fr;
  80. gap: 1px;
  81. background-color: rgb(243, 245, 247);
  82. }
  83. main .right .right-top {
  84. width: 100%;
  85. display: grid;
  86. grid-template-rows: 50% 1fr;
  87. place-items: center;
  88. background-color: white;
  89. border-top-left-radius: 20px;
  90. border-top-right-radius: 20px;
  91. }
  92. main .right .right-bottom {
  93. width: 100%;
  94. height: 100%;
  95. display: grid;
  96. grid-template: 2/7;
  97. background-color: white;
  98. border-bottom-left-radius: 20px;
  99. border-bottom-right-radius: 20px;
  100. }
  101. main .right .right-top .right-top-content {
  102. display: grid;
  103. width: 100%;
  104. height: 100%;
  105. grid-template-columns: 30% 1fr;
  106. padding: 20px;
  107. place-items: end start;
  108. }
  109. main .right .right-top .right-top-content > img {
  110. width: 40px;
  111. height: 40px;
  112. border-radius: 40px;
  113. }
  114. main .right .right-top .right-top-content > dl {
  115. margin-left: 10px;
  116. }
  117. main .right .right-top .right-top-content > dl > dt {
  118. margin-bottom: 10px;
  119. }
  120. main .right .right-top .right-top-content > dl > dt > a {
  121. font-weight: bold;
  122. color: #000;
  123. font-size: 14px;
  124. line-height: 1px;
  125. }
  126. main .right .right-top .right-top-content > dl > dd {
  127. color: #999999;
  128. font-size: 8px;
  129. }
  130. main .right .right-top .right-top-button > button {
  131. width: 150px;
  132. height: 34px;
  133. outline: none;
  134. background-color: #f11717;
  135. border-radius: 100px;
  136. color: #fff;
  137. text-align: center;
  138. border: 0px;
  139. }
  140. main .right .right-top .right-top-button > button:hover {
  141. background-color: #d60707;
  142. }
  143. main .right .right-bottom .right-bottom-content {
  144. width: 100%;
  145. padding: 20px;
  146. text-align: left;
  147. }
  148. main .right .right-bottom .right-bottom-content .right-bottom-content-top > a {
  149. padding: 0px 4px;
  150. background: #ff583d;
  151. border-radius: 10%;
  152. color: #ffffff;
  153. font-size: 12px;
  154. margin-left: 10px;
  155. }
  156. main .right .right-bottom .right-bottom-content .right-bottom-content-list {
  157. display: grid;
  158. grid-template-rows: repeat(6, 20px);
  159. gap: 15px;
  160. overflow: hidden;
  161. }
  162. main .right .right-bottom .right-bottom-content .right-bottom-content-list div {
  163. display: flex;
  164. }
  165. main
  166. .right
  167. .right-bottom
  168. .right-bottom-content
  169. .right-bottom-content-list
  170. > div:first-child {
  171. margin: 0;
  172. padding: 0;
  173. grid-row: span 2;
  174. padding-top: 15px;
  175. }
  176. main
  177. .right
  178. .right-bottom
  179. .right-bottom-content
  180. .right-bottom-content-list
  181. span {
  182. flex-shrink: 0;
  183. margin-right: 10px;
  184. }
  185. main .right .right-bottom .right-bottom-content .right-bottom-content-list a {
  186. font-size: 14px;
  187. color: #ccc;
  188. overflow: hidden;
  189. }
  190. main
  191. .right
  192. .right-bottom
  193. .right-bottom-content
  194. .right-bottom-content-list
  195. a:first-child {
  196. font-size: 14px;
  197. color: #ccc;
  198. margin-left: 10px;
  199. background: #ff583d;
  200. }
  201. main
  202. .right
  203. .right-bottom
  204. .right-bottom-content
  205. .right-bottom-content-list
  206. a:hover {
  207. color: red;
  208. }
  209. main .bottom-right {
  210. display: grid;
  211. width: 100%;
  212. padding: 10px;
  213. grid-template-columns: repeat(2, 50%);
  214. text-align: center;
  215. }
  216. main .bottom-right div {
  217. display: grid;
  218. width: 100%;
  219. grid-template-rows: 50px, 1fr;
  220. gap: 5px;
  221. }
  222. main .bottom-right span {
  223. color: #333333;
  224. font-size: 40px;
  225. }
  226. main .bottom-right a:hover {
  227. color: red;
  228. font-weight: bold;
  229. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议