博客列表 >学习仿做PHP中文网主页

学习仿做PHP中文网主页

华宥为
华宥为原创
2021年01月03日 20:14:04694浏览

学习仿做PHP中文网主页

HTML部分

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>学习仿作PHP中文网</title>
  7. <link rel="stylesheet" href="/0101/php.css" />
  8. </head>
  9. <body>
  10. <!-- 页眉 -->
  11. <header>
  12. <div class="headernavs">
  13. <ul class="navs">
  14. <li>
  15. <a href=""><img src="/0101/images/1.png" alt="" /></a>
  16. </li>
  17. <li><a href="">首页</a></li>
  18. <li><a href="">视频教程</a></li>
  19. <li><a href="">入门教程</a></li>
  20. <li><a href="">社区问答</a></li>
  21. <li><a href="">技术文章</a></li>
  22. <li><a href="">资源下载</a></li>
  23. <li><a href="">编程词典</a></li>
  24. <li><a href="">工具下载</a></li>
  25. <li><a href="">PHP培训</a></li>
  26. <li></li>
  27. </ul>
  28. </div>
  29. </header>
  30. <div class="main-top">
  31. <!-- 侧边菜单 -->
  32. <nav class="menus">
  33. <a href=""><img src="/0101/images/cbl.png" alt="" /></a>
  34. </nav>
  35. <!-- 顶部菜单 -->
  36. <ul class="navs">
  37. <li><a href="">PHP头条</a></li>
  38. <li><a href="">独孤九贱</a></li>
  39. <li><a href="">学习路线</a></li>
  40. <li><a href="">在线工具</a></li>
  41. <li><a href="">趣味课堂</a></li>
  42. <li><a href="">社区问答</a></li>
  43. <li><a href="">课程直播</a></li>
  44. <li><input type="text" placeholder="输入关键字" /></li>
  45. </ul>
  46. <div class="slider">
  47. <!-- 轮播图 -->
  48. <a href=""><img src="/0101/picture/61.jpg" alt="" /></a>
  49. </div>
  50. <!-- 课程推荐区 -->
  51. <ul class="course">
  52. <li>
  53. <a href=""><img src="/0101/picture/99.jpg" alt="" /></a>
  54. </li>
  55. <li>
  56. <a href=""><img src="/0101/picture/98.jpg" alt="" /></a>
  57. </li>
  58. <li>
  59. <a href=""><img src="/0101/picture/97.jpg" alt="" /></a>
  60. </li>
  61. <li>
  62. <a href=""><img src="/0101/picture/96.jpg" alt="" /></a>
  63. </li>
  64. </ul>
  65. </div>
  66. <div class="main-min">
  67. <a href=""><img src="/0101/picture/69.jpg" alt="" /></a>
  68. </div>
  69. <!-- 课程列表区 -->
  70. <div class="main-coures">
  71. <h3>&lt;\&gt;php入门精品课程&lt;\&gt;</h3>
  72. <ul class="coures-list">
  73. <li>
  74. <a href=""><img src="/0101/picture/1342.jpg" alt="" /></a>
  75. </li>
  76. <li>
  77. <a href=""><img src="/0101/picture/100.jpg" alt="" /></a>
  78. </li>
  79. <li>
  80. <a href=""><img src="/0101/picture/101.jpg" alt="" /></a>
  81. </li>
  82. <li>
  83. <a href=""><img src="/0101/picture/102.jpg" alt="" /></a>
  84. </li>
  85. <li>
  86. <a href=""><img src="/0101/picture/103.jpg" alt="" /></a>
  87. </li>
  88. <li>
  89. <a href=""><img src="/0101/picture/104.jpg" alt="" /></a>
  90. </li>
  91. <li>
  92. <a href=""><img src="/0101/picture/105.jpg" alt="" /></a>
  93. </li>
  94. <li>
  95. <a href=""><img src="/0101/picture/107.jpg" alt="" /></a>
  96. </li>
  97. <li>
  98. <a href=""><img src="/0101/picture/108.jpg" alt="" /></a>
  99. </li>
  100. <li>
  101. <a href=""><img src="/0101/picture/109.jpg" alt="" /></a>
  102. </li>
  103. <li>
  104. <a href=""><img src="/0101/picture/110.jpg" alt="" /></a>
  105. </li>
  106. <li>
  107. <a href=""><img src="/0101/picture/111.jpg" alt="" /></a>
  108. </li>
  109. <li>
  110. <a href=""><img src="/0101/picture/112.jpg" alt="" /></a>
  111. </li>
  112. <li>
  113. <a href=""><img src="/0101/picture/113.jpg" alt="" /></a>
  114. </li>
  115. </ul>
  116. </div>
  117. <!-- 页脚 -->
  118. <footer>页脚</footer>
  119. </body>
  120. </html>

css部分

  • php.css
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. li {
  7. list-style: none;
  8. }
  9. a {
  10. color: #444444;
  11. text-decoration: none;
  12. }
  13. header {
  14. height: 80px;
  15. background-color: lightskyblue;
  16. margin-bottom: 30px;
  17. }
  18. .headernavs > ul.navs {
  19. display: grid;
  20. grid-template-columns: 160px repeat(10, 130px) 1fr;
  21. place-items: center;
  22. }
  23. footer {
  24. height: 60px;
  25. color: #eee;
  26. background-color: #444;
  27. }
  28. /* --------------------------------- */
  29. .main-top {
  30. height: 550px;
  31. width: 1200px;
  32. margin-bottom: 30px;
  33. /* background-color: #ccc; */
  34. display: grid;
  35. grid-template-columns: 216px 1fr;
  36. grid-template-rows: 60px 1fr 155px;
  37. margin: auto;
  38. }
  39. .main-min > a > img {
  40. width: 1200px;
  41. height: 80px;
  42. margin-bottom: 30px;
  43. background-color: brown;
  44. display: grid;
  45. grid-template-columns: 1fr;
  46. grid-template-rows: 1fr;
  47. margin: 30px auto;
  48. border-radius: 10px;
  49. }
  50. /* 左侧导航区 */
  51. .main-top > nav.menus {
  52. grid-area: span 3;
  53. background-color: lightgreen;
  54. border-radius: 10px 0 0 10px;
  55. }
  56. /* 左侧导航区附一张图片代替 */
  57. .main-top > nav.menus > a > img {
  58. width: 100%;
  59. height: 100%;
  60. border-radius: 10px 0 0 10px;
  61. }
  62. /* 顶部的导航区 */
  63. .main-top > ul.navs {
  64. background-color: lightcyan;
  65. display: grid;
  66. grid-template-columns: repeat(8, 103px) 1fr;
  67. place-items: center;
  68. border-radius: 0 10px 0 0;
  69. }
  70. .main-top > ul.navs > li:last-of-type {
  71. place-self: center start;
  72. padding-left: 80px;
  73. }
  74. /* 轮播图已经自动归位了 */
  75. .main-top > ul.course {
  76. background-color: wheat;
  77. padding: 10px;
  78. display: grid;
  79. grid-template-columns: repeat(4, 1fr);
  80. gap: 10px;
  81. border-radius: 0 0 10px 0;
  82. }
  83. .main-top > ul.course > *:hover {
  84. background-color: pink;
  85. cursor: pointer;
  86. transition: 1s;
  87. }
  88. .main-top .slider {
  89. background-color: #cccc;
  90. }
  91. .main-top .slider > a > img {
  92. height: 100%;
  93. width: 100%;
  94. }
  95. .main-top > ul.course > * {
  96. background-color: violet;
  97. cursor: pointer;
  98. border-radius: 5px;
  99. }
  100. .main-top > ul.course > li > a > img {
  101. height: 100%;
  102. width: 100%;
  103. cursor: pointer;
  104. border-radius: 5px;
  105. }
  106. /* ------------------------------ */
  107. .main-coures {
  108. width: 1200px;
  109. height: 646px;
  110. padding: 15px;
  111. background-color: lightskyblue;
  112. margin: 30px auto;
  113. display: grid;
  114. grid-template-rows: 50px 1fr;
  115. gap: 20px;
  116. border-radius: 10px;
  117. }
  118. .main-coures h3 {
  119. color: #444444;
  120. text-align: center;
  121. /* margin-bottom: 30px; */
  122. }
  123. .main-coures .coures-list {
  124. display: grid;
  125. grid-template-columns: repeat(5, 1fr);
  126. grid-template-rows: repeat(3, 1fr);
  127. /* grid-template-columns: repeat(auto-fit,minmax(15em,1fr)); */
  128. /* grid-template-rows: repeat(auto-fit,minmax(13em,70%)); */
  129. gap: 10px;
  130. }
  131. .main-coures .coures-list > * {
  132. background-color: lightcyan;
  133. border-radius: 10px;
  134. }
  135. .main-coures .coures-list > li > a > img {
  136. width: 100%;
  137. }
  138. .main-coures .coures-list > li:first-of-type {
  139. grid-area: span 2;
  140. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议