博客列表 >仿PHP中文网首页

仿PHP中文网首页

天宁
天宁原创
2022年03月29日 19:28:46433浏览

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="//at.alicdn.com/t/font_3269118_mgnsjoz5gtp.css" />
  9. <link rel="stylesheet" href="static/font-icon/iconfont.css" />
  10. <link rel="stylesheet" href="static/css/header.css" />
  11. <link rel="stylesheet" href="static/css/main-nav.css" />
  12. <title>仿php.cn中文网首页差头部</title>
  13. </head>
  14. <body>
  15. <!-- 页眉 -->
  16. <header>
  17. <!-- 1 顶部 -->
  18. <div class="top">
  19. <div class="content">
  20. <div class="title">php中文网,程序员梦开始的地方!</div>
  21. <div class="right">
  22. <a href="" class="iconfont icon-tixing"></a>
  23. <a href=""><img src="static/images/user-pic.jpeg" alt="" /></a>
  24. </div>
  25. </div>
  26. </div>
  27. <!-- 2 导航 -->
  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-fangdajing fdj"></span>
  41. </div>
  42. </div>
  43. </div>
  44. </header>
  45. <!-- 主体 -->
  46. <main>
  47. <div class="navs">
  48. <!-- 2行3列 -->
  49. <div class="left">
  50. <a href="">php开发</a>
  51. <a href="">大前端</a>
  52. <a href="">后端开发</a>
  53. <a href="">数据库</a>
  54. <a href="">移动端</a>
  55. <a href="">运维开发</a>
  56. <a href="">UI设计</a>
  57. <a href="">计算机基础</a>
  58. </div>
  59. <div class="slider">
  60. <a href="">
  61. <img src="static/images/slider.jpeg" alt="" />
  62. </a>
  63. </div>
  64. <div class="right">
  65. <div class="rightxx">
  66. <div class="right-top">
  67. <img src="./img/user_avatar.jpg" alt="" />
  68. <div class="xmsj">
  69. <span>天宁</span>
  70. <span>p豆 12</span>
  71. </div>
  72. <button>我的学习</button>
  73. </div>
  74. <div class="right-bottom">
  75. <span>问答社区</span>
  76. <a href="#">答疑</a>
  77. <span>头条</span>
  78. <a href="#">JetBrains和Gitlab均表明暂停</a>
  79. <span>新课</span>
  80. <a href="#">3.9号公益直播</a>
  81. <span>新班</span>
  82. <a href="#">19期PHP直播班</a>
  83. <span>招募</span>
  84. <a href="#">课程合作计划</a>
  85. <span>公告</span>
  86. <a href="#">APP上线啦</a>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="bottom-left">
  91. <!-- 学习路径 -->
  92. <div class="desc">
  93. <div class="title">学习路径</div>
  94. <span>全部7个&gt;</span>
  95. </div>
  96. <ul class="detail">
  97. <li onclick="">
  98. <img src="static/images//dgjj.png" alt="" />
  99. <a href="">独孤九贱</a>
  100. <span>9门课程</span>
  101. </li>
  102. <li onclick="">
  103. <img src="static/images//ynxj.png" alt="" />
  104. <a href="">独孤九贱</a>
  105. <span>9门课程</span>
  106. </li>
  107. <li onclick="">
  108. <img src="static/images//phpkjkf.png" alt="" />
  109. <a href="">独孤九贱</a>
  110. <span>9门课程</span>
  111. </li>
  112. <li onclick="">
  113. <img src="static/images//phpksrm.png" alt="" />
  114. <a href="">趣味闯关</a>
  115. <span>9门课程</span>
  116. </li>
  117. <li onclick="">
  118. <img src="static/images//dgjj.png" alt="" />
  119. <a href="">独孤九贱</a>
  120. <span>9门课程</span>
  121. </li>
  122. </ul>
  123. </div>
  124. <div class="bottom-right">
  125. <img src="./img/gzh.png" alt="" />
  126. <img src="./img/qqq.png" alt="" />
  127. <span>官方公众号</span>
  128. <span>官方QQ群</span>
  129. </div>
  130. </div>
  131. <!-- 最新课程 -->
  132. <div class="zxkc">
  133. <span>最新课程</span>
  134. <span>更多&gt;</span>
  135. <div class="items">
  136. <div class="item">
  137. <a href=""><img src="static/images/zxkc1.png" alt="" /></a>
  138. <div class="title">
  139. <span>中级</span>
  140. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  141. </div>
  142. <div class="sc">
  143. <span>1372次学习</span>
  144. <div>
  145. <div class="iconfont icon-shoucang"></div>
  146. <span>收藏</span>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="item">
  151. <a href=""><img src="static/images/zxkc2.png" alt="" /></a>
  152. <div class="title">
  153. <span>中级</span>
  154. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  155. </div>
  156. <div class="sc">
  157. <span>1372次学习</span>
  158. <div>
  159. <div class="iconfont icon-shoucang"></div>
  160. <span>收藏</span>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="item">
  165. <a href=""><img src="static/images/zxkc3.png" alt="" /></a>
  166. <div class="title">
  167. <span>中级</span>
  168. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  169. </div>
  170. <div class="sc">
  171. <span>1372次学习</span>
  172. <div>
  173. <div class="iconfont icon-shoucang"></div>
  174. <span>收藏</span>
  175. </div>
  176. </div>
  177. </div>
  178. <div class="item">
  179. <a href=""><img src="static/images/zxkc4.png" alt="" /></a>
  180. <div class="title">
  181. <span>中级</span>
  182. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  183. </div>
  184. <div class="sc">
  185. <span>1372次学习</span>
  186. <div>
  187. <div class="iconfont icon-shoucang"></div>
  188. <span>收藏</span>
  189. </div>
  190. </div>
  191. </div>
  192. <div class="item">
  193. <a href=""><img src="static/images/zxkc5.png" alt="" /></a>
  194. <div class="title">
  195. <span>中级</span>
  196. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  197. </div>
  198. <div class="sc">
  199. <span>1372次学习</span>
  200. <div>
  201. <div class="iconfont icon-shoucang"></div>
  202. <span>收藏</span>
  203. </div>
  204. </div>
  205. </div>
  206. <div class="item">
  207. <a href=""><img src="static/images/zxkc6.png" alt="" /></a>
  208. <div class="title">
  209. <span>中级</span>
  210. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  211. </div>
  212. <div class="sc">
  213. <span>1372次学习</span>
  214. <div>
  215. <div class="iconfont icon-shoucang"></div>
  216. <span>收藏</span>
  217. </div>
  218. </div>
  219. </div>
  220. <div class="item">
  221. <a href=""><img src="static/images/zxkc7.png" alt="" /></a>
  222. <div class="title">
  223. <span>中级</span>
  224. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  225. </div>
  226. <div class="sc">
  227. <span>1372次学习</span>
  228. <div>
  229. <div class="iconfont icon-shoucang"></div>
  230. <span>收藏</span>
  231. </div>
  232. </div>
  233. </div>
  234. <div class="item">
  235. <a href=""><img src="static/images/zxkc8.png" alt="" /></a>
  236. <div class="title">
  237. <span>中级</span>
  238. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  239. </div>
  240. <div class="sc">
  241. <span>1372次学习</span>
  242. <div>
  243. <div class="iconfont icon-shoucang"></div>
  244. <span>收藏</span>
  245. </div>
  246. </div>
  247. </div>
  248. <div class="item">
  249. <a href=""><img src="static/images/zxkc9.png" alt="" /></a>
  250. <div class="title">
  251. <span>中级</span>
  252. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  253. </div>
  254. <div class="sc">
  255. <span>1372次学习</span>
  256. <div>
  257. <div class="iconfont icon-shoucang"></div>
  258. <span>收藏</span>
  259. </div>
  260. </div>
  261. </div>
  262. <div class="item">
  263. <a href=""><img src="static/images/zxkc10.png" alt="" /></a>
  264. <div class="title">
  265. <span>中级</span>
  266. <a href="">HTTP协议HTTP协议HTTP协议HTTP协议</a>
  267. </div>
  268. <div class="sc">
  269. <span>1372次学习</span>
  270. <div>
  271. <div class="iconfont icon-shoucang"></div>
  272. <span>收藏</span>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. </main>
  279. </body>
  280. </html>

由于是在老师代码基础上增加的,所以只展示我写的部分代码

right导航部分css代码

  1. /* 导航right */
  2. header .navs {
  3. width: 100vw;
  4. height: 90px;
  5. background-color: #fff;
  6. }
  7. header .navs .content {
  8. width: 1200px;
  9. /* border: 1px solid #000; */
  10. display: grid;
  11. grid-template-columns: 140px 1fr 200px;
  12. grid-auto-rows: 90px;
  13. gap: 10px;
  14. margin: auto;
  15. place-items: center start;
  16. }
  17. header .navs .content img {
  18. width: 100%;
  19. }
  20. header .navs .content nav a.active,
  21. header .navs .content nav a:hover {
  22. color: red;
  23. font-weight: bold;
  24. }
  25. header .navs .content .search {
  26. display: flex;
  27. }
  28. header .navs .content nav a {
  29. padding: 0 10px;
  30. }
  31. header .navs .content .search input[type="search"] {
  32. width: 200px;
  33. height: 36px;
  34. border: none;
  35. outline: none;
  36. background-color: #f7f8fa;
  37. border-radius: 20px;
  38. padding-left: 10px;
  39. }
  40. header .navs .content .search .fdj {
  41. font-size: 22px;
  42. color: #ccc;
  43. position: relative;
  44. left: -40px;
  45. top: 5px;
  46. }

最新课程部分css代码

  1. /* 最新课程 */
  2. main .zxkc {
  3. display: grid;
  4. /* grid-template-columns: repeat(2, 1fr);
  5. grid-template-rows: 60px 1fr; */
  6. grid-template-columns: 1160px;
  7. grid-template-rows: 32px 530px;
  8. place-content: center;
  9. gap: 20px 0;
  10. margin: 30px 20px;
  11. }
  12. /* 最新课程标题加粗放大 */
  13. main .zxkc > span:first-of-type {
  14. font-size: 28px;
  15. font-weight: bolder;
  16. }
  17. /* 更多字体颜色调成灰色 */
  18. main .zxkc > span:last-of-type {
  19. color: #999999;
  20. }
  21. /* 具体课程区 */
  22. main .zxkc .items {
  23. grid-area: 2 / 1 / 3 / 3;
  24. width: 1200px;
  25. display: grid;
  26. grid-template-columns: repeat(5, 1fr);
  27. grid-auto-rows: repeat(2, 1fr);
  28. /* place-content: center; */
  29. gap: 10px;
  30. }
  31. /* 设置课程背景和高度圆角 */
  32. main .zxkc .items .item {
  33. border-radius: 10px;
  34. background-color: white;
  35. height: 235px;
  36. }
  37. /* 设置图片和上方圆角 */
  38. main .zxkc .items .item img {
  39. width: 100%;
  40. border-top-left-radius: 10px;
  41. border-top-right-radius: 10px;
  42. }
  43. /* 课程标题设置位置 */
  44. main .zxkc .items .item .title {
  45. margin: 15px 5px 0px 15px;
  46. }
  47. /* 等级样式 */
  48. main .zxkc .items .item .title span {
  49. background-color: #93999f;
  50. color: #fff;
  51. padding: 0px 3px;
  52. }
  53. /* 标题鼠标移动至变红 */
  54. main .zxkc .items .item .title a:hover {
  55. color: red;
  56. cursor: pointer;
  57. }
  58. /* 浏览次数和收藏 */
  59. main .zxkc .items .item .sc {
  60. color: #999999;
  61. display: flex;
  62. place-content: space-between;
  63. margin: 20px 15px 10px;
  64. }
  65. main .zxkc .items .item .sc div {
  66. display: flex;
  67. place-items: center;
  68. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议