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

仿php中文网首页

centos
centos原创
2022年04月28日 18:51:50438浏览

仿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. <title>仿php首页</title>
  8. <link rel="stylesheet" href="./0325/css/main.css" />
  9. <link rel="stylesheet" href="./0325/css/header.css" />
  10. <link rel="stylesheet" href="./0325/css/body.css" />
  11. <link
  12. rel="stylesheet"
  13. href="//at.alicdn.com/t/font_3336421_9myre1c64du.css"
  14. />
  15. </head>
  16. <body>
  17. <!-- 顶部 -->
  18. <header>
  19. <div class="top">
  20. <!-- 上半部分 -->
  21. <div class="top-in">
  22. <div class="title">php-程序员梦开始的地方</div>
  23. <div class="right">
  24. <a class="iconfont icon-lingdang"></a>
  25. <a href=""><img src="./0325/img/logo.png" alt="" /></a>
  26. </div>
  27. </div>
  28. <!-- 下半部分 导航-->
  29. <div class="navs">
  30. <div class="content">
  31. <a href=""><img src="./0325/img/logo1.png" alt="" /></a>
  32. <nav>
  33. <a href="1">首页</a>
  34. <a href="2">视频教程</a>
  35. <a href="3">学习路径</a>
  36. <a href="4">资源下载</a>
  37. <a href="4">技术文章</a>
  38. </nav>
  39. <div class="search">
  40. <input type="search" value="输入关键词搜索" />
  41. <span class="iconfont icon-Magnifier"></span>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </header>
  47. <!-- 内容区 -->
  48. <main>
  49. <div class="center">
  50. <!-- 两行三列 -->
  51. <!-- 左上导航 -->
  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. <!-- 中间图片 -->
  63. <div class="slider">
  64. <a href="">
  65. <img src="./0325/img/b.jpg" alt="" />
  66. </a>
  67. </div>
  68. <!-- 右边 -->
  69. <div class="right">xxx</div>
  70. <!-- 下左 -->
  71. <div class="bottom-left">
  72. <div class="desc">
  73. <div class="title">学习路径</div>
  74. <span>全部7个&gt</span>
  75. </div>
  76. <ul class="detail">
  77. <li onclick="">
  78. <img src="./0325/img/dgjj.png" alt="" />
  79. <a href="">独孤九贱</a>
  80. <span>9门课程</span>
  81. </li>
  82. <li onclick="">
  83. <img src="./0325/img/phpkjkf.png" alt="" />
  84. <a href="">独孤九贱</a>
  85. <span>9门课程</span>
  86. </li>
  87. <li onclick="">
  88. <img src="./0325/img/phpkjkf.png" alt="" />
  89. <a href="">独孤九贱</a>
  90. <span>9门课程</span>
  91. </li>
  92. <li onclick="">
  93. <img src="./0325/img/phpkjkf.png" alt="" />
  94. <a href="">独孤九贱</a>
  95. <span>9门课程</span>
  96. </li>
  97. <!-- <li onclick="">
  98. <img src="./0325/img/phpkjkf.png" alt="" />
  99. <a href="">独孤九贱</a>
  100. <span>9门课程</span>
  101. </li> -->
  102. </ul>
  103. </div>
  104. <!-- 下右 -->
  105. <div class="bottom-right">公众号</div>
  106. </div>
  107. </main>
  108. </body>
  109. </html>

以下是css代码

  1. /* 格式化 */
  2. * {
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. a {
  8. /* 取消横线 */
  9. text-decoration: none;
  10. color: #555;
  11. }
  12. li {
  13. /* 去掉原点 */
  14. list-style: none;
  15. }
  16. body {
  17. background-color: rgb(243, 245, 247);
  18. }
  19. /* 顶部样式 */
  20. header .top {
  21. background-color: #343434;
  22. width: 100vm;
  23. height: 40px;
  24. color: #aaa;
  25. }
  26. header .top .top-in {
  27. /* 定义宽度 */
  28. width: 1200px;
  29. display: grid;
  30. grid-template-columns: 200px 140px;
  31. grid-auto-rows: 40px;
  32. margin: auto;
  33. place-content: space-between;
  34. place-items: center start;
  35. }
  36. header .top .top-in .title {
  37. font-size: 16px;
  38. font-weight: bolder;
  39. }
  40. /* 头像 */
  41. header .top .top-in img {
  42. width: 50%;
  43. border-radius: 50%;
  44. }
  45. /* 登录框 */
  46. header .top .top-in .right {
  47. display: grid;
  48. grid-template-columns: repeat(2, 1fr);
  49. place-items: center center;
  50. }
  51. .iconfont.icon-lingdang {
  52. color: aliceblue;
  53. font-size: 20px;
  54. }
  55. header .navs {
  56. width: 100vm;
  57. height: 80px;
  58. background-color: #fff;
  59. font-size: 20px;
  60. }
  61. /* 设置中间区域 */
  62. header .navs .content {
  63. width: 1200px;
  64. margin: auto;
  65. display: grid;
  66. grid-template-columns: 140px 1fr 200px;
  67. grid-auto-flow: 45px;
  68. gap: 10px;
  69. place-items: center start;
  70. }
  71. /* 设置logo */
  72. header .navs .content a img {
  73. width: 100%;
  74. }
  75. header .navs .content nav {
  76. display: flex;
  77. }
  78. /* 设置导航 */
  79. header .navs .content nav a:first-of-type,
  80. header .navs .content nav a:hover,
  81. header .navs .content nav a:active {
  82. color: red;
  83. font-weight: bold;
  84. }
  85. /* 增加间距 */
  86. header .navs .content nav a {
  87. padding: 0 30px;
  88. }
  89. /* 小搜索框 */
  90. header .navs .content .search {
  91. display: flex;
  92. }
  93. header .navs .content .search input[type="search"] {
  94. /* border: none; */
  95. width: 180px;
  96. height: 40px;
  97. background-color: #f7f8fa;
  98. border-radius: 20px;
  99. border: none;
  100. outline: none;
  101. color: #9999;
  102. font-size: 12px;
  103. }
  104. header .navs .content .search .icon-Magnifier {
  105. font-size: 20px;
  106. color: #ccc;
  107. position: relative;
  108. left: -40px;
  109. top: 10px;
  110. }
  111. main {
  112. font-size: 14px;
  113. }
  114. main .center {
  115. display: grid;
  116. grid-template-columns: 160px 810px 190px;
  117. grid-template-rows: 400px 80px;
  118. place-content: center;
  119. gap: 20px;
  120. margin: 100px 0;
  121. /* place-items: center start; */
  122. }
  123. /* 统一框架 方便看到统一样式 */
  124. main .center > * {
  125. background-color: #fff;
  126. border-radius: 10px;
  127. }
  128. main .center .bottom-left {
  129. grid-column: span 2;
  130. }
  131. /* 上左导航 */
  132. main .center .left {
  133. display: grid;
  134. place-items: center;
  135. padding: 20px 0;
  136. }
  137. main .center .left a {
  138. padding: 10px 20px;
  139. }
  140. main .center .left a:hover {
  141. color: lightcoral;
  142. background-color: rgb(250, 223, 227);
  143. border-radius: 20px;
  144. }
  145. /* 轮播图 */
  146. main .center .slider img {
  147. width: 100%;
  148. /* height: 400px; */
  149. border-radius: 20px;
  150. }
  151. /* 底部小图 */
  152. main .bottom-left {
  153. display: grid;
  154. grid-template-columns: 140px 1fr;
  155. gap: 10px;
  156. }
  157. main .bottom-left .desc {
  158. display: grid;
  159. place-items: center;
  160. padding: 20px 0;
  161. }
  162. main .bottom-left .desc span {
  163. font-size: 12px;
  164. color: #aaa;
  165. }
  166. /* 中间 */
  167. main .bottom-left .detail {
  168. display: flex;
  169. place-content: space-between;
  170. place-items: center start;
  171. }
  172. main .bottom-left .detail li img {
  173. width: 100%;
  174. grid-row: span 2;
  175. }
  176. main .bottom-left .detail li {
  177. display: grid;
  178. grid-template-columns: 36px 84px;
  179. gap: 0 10px;
  180. place-items: center start;
  181. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议