Blogger Information
Blog 7
fans 0
comment 0
visits 3449
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
仿php中文网右侧导航
Original
347 people have browsed it

效果

代码

HTML页面代码

  1. <head>
  2. <meta charset="UTF-8">
  3. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <link rel="stylesheet" href="static/csstext/headertext.css">
  6. <link rel="stylesheet" href="static/csstext/resettext.css">
  7. <link rel="stylesheet" href="static/csstext/maintext.css">
  8. <title>仿PHP中文网首页头部</title>
  9. </head>
  10. <body>
  11. <!-- 页眉 -->
  12. <header>
  13. <!-- 1 顶部 -->
  14. <div class="top">
  15. <div class="content1">
  16. <div class="dream">欢迎光临-梦开始的地方!</div>
  17. <div class="topright">
  18. <div class="ding">提醒</div>
  19. <div class="denglu">登录</div>
  20. </div>
  21. </div>
  22. </div>
  23. <!-- 2 导航 -->
  24. <div class="navigations">
  25. <div class="content2">
  26. <a href="" class="logo"><img src="static/images/logo.png" alt="" /></a>
  27. <nav>
  28. <a href="" class="shouye">首页</a>
  29. <a href="">视频教学</a>
  30. <a href="">学习路径</a>
  31. <a href="">PHP培训</a>
  32. <a href="">资源下载</a>
  33. </nav>
  34. <div class="search">
  35. <input type="search" placeholder="输入关键字搜索"/>
  36. <span class=""></span>
  37. </div>
  38. </div>
  39. </div>
  40. </header>
  41. <!-- 主体 -->
  42. <main>
  43. <div class="navigation2">
  44. <!-- 2行3列 -->
  45. <div class="left">
  46. <a href="">PHP开发</a>
  47. <a href="">大前端</a>
  48. <a href="">PHP开发</a>
  49. <a href="">PHP开发</a>
  50. <a href="">PHP开发</a>
  51. <a href="">PHP开发</a>
  52. <a href="">PHP开发</a>
  53. <a href="">PHP开发</a>
  54. </div>
  55. <div class="slider">
  56. <a href="">
  57. <img src="static/images/slider.jpeg" alt="" />
  58. </a>
  59. </div>
  60. <div class="right">
  61. <div class="user">
  62. <div class="userID">
  63. <img src="static/images/touxiang.jpeg" alt="">
  64. <div class="userID-desc">
  65. <a href="">手机用户01</a>
  66. <span>P豆 12</span>
  67. </div>
  68. </div>
  69. <div class="study">
  70. <button>我的学习</button>
  71. </div>
  72. </div>
  73. <ul class="wenda">
  74. <li class="cont1">
  75. <span>问答社区</span>
  76. <a href="">答疑</a>
  77. </li>
  78. <li class="cont2">
  79. <span>头条</span>
  80. <a href="">520专属浪漫表白方式!</a>
  81. </li>
  82. <li class="cont3">
  83. <span>福利</span>
  84. <a href="">编程书籍>></a>
  85. </li>
  86. <li class="cont4">
  87. <span>新班</span>
  88. <a href="">大前端上线</a>
  89. </li>
  90. <li class="cont5">
  91. <span>招募</span>
  92. <a href="">课程合作计划</a>
  93. </li>
  94. <li class="cont6">
  95. <span>公告</span>
  96. <a href="">APP上线啦</a>
  97. </li>
  98. </ul>
  99. </div>
  100. <div class="bottom-left">
  101. <!-- 学习路径 -->
  102. <div class="desc">
  103. <div class="title">学习路径</div>
  104. <span>全部7个</span>
  105. </div>
  106. <ul class="detail">
  107. <li>
  108. <img src="static/images/dgjj.png" alt="">
  109. <a href="">独孤九贱</a>
  110. <span>9门课程<span>
  111. </li>
  112. <li>
  113. <img src="static/images/dgjj.png" alt="">
  114. <a href="">玉女心经</a>
  115. <span>5门课程<span>
  116. </li>
  117. <li>
  118. <img src="static/images/dgjj.png" alt="">
  119. <a href="">天龙八部</a>
  120. <span>3门课程<span>
  121. </li>
  122. <li>
  123. <img src="static/images/dgjj.png" alt="">
  124. <a href="">自学指南</a>
  125. <span>19门课程<span>
  126. </li>
  127. <li>
  128. <img src="static/images/dgjj.png" alt="">
  129. <a href="">趣味闯关</a>
  130. <span>22门课程<span>
  131. </li>
  132. </ul>
  133. </div>
  134. <div class="bottom-right">
  135. <ul>
  136. <li class="tubiao1">
  137. <a href="">
  138. <img src="static/images/weixin.png" alt=""></img>
  139. <h5>官方公众号</h5>
  140. </a>
  141. </li>
  142. <li class="tubiao1">
  143. <a href="">
  144. <img src="static/images/qq.png" alt=""></img>
  145. <h5>官方QQ群</h5>
  146. </a>
  147. </li>
  148. </ul>
  149. </div>
  150. </div>
  151. </main>
  152. </body>

resettext.css

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

headertext.css

  1. header .top{
  2. width: 100vw;
  3. height: 40px;
  4. background-color: rgb(52,52,52) ;
  5. color: #aaa;
  6. }
  7. header .top .content1 img {
  8. width: 50%;
  9. border-radius: 50%;
  10. }
  11. header .top .content1 {
  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 .content1 .topright {
  21. display:grid;
  22. grid-template-columns:repeat(2,1fr);
  23. place-items: center;
  24. }
  25. /* 导航 */
  26. header .navigations {
  27. width: 100vw;
  28. height: 90px;
  29. background-color:#fff;
  30. }
  31. header .navigations .content2 {
  32. width: 1200px;
  33. display: grid;
  34. grid-template-columns: 140px 1fr 200px;
  35. grid-auto-rows:90px;
  36. gap:10px;
  37. margin: auto;
  38. place-items: center start;
  39. }
  40. header .navigations .content2 img {
  41. width:100%;
  42. }
  43. header .navigations .content2 nav a.shouye,
  44. header .navigations .content2 nav a:hover {
  45. color:red;
  46. font-weight:bold;
  47. }
  48. header .navigations .content2 nav a {
  49. padding: 0 10px;
  50. }
  51. header .navigations .content2 .search {
  52. display: flex;
  53. }
  54. header .navigations .content2 .search input[type='search'] {
  55. width: 200px;
  56. height: 36px;
  57. border: none;
  58. outline: none;
  59. background-color: #f7f8fa;
  60. border-radius: 20px;
  61. padding-left: 10px;
  62. }

maintext.css

  1. main {
  2. font-size: 14px;
  3. }
  4. main .navigation2 {
  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 .navigation2>*{
  14. background-color:#fff;
  15. border-radius: 20px;
  16. }
  17. /* 底部左侧占2列 */
  18. main .navigation2 .bottom-left {
  19. grid-column:span 2;
  20. }
  21. main .navigation2 .slider img {
  22. width:100%;
  23. border-radius: 20px;
  24. }
  25. /* 左侧导航 */
  26. main .navigation2 .left {
  27. display:grid;
  28. place-items:center;
  29. padding:20px 0;
  30. }
  31. main .navigation2 .left a:hover{
  32. color:red;
  33. background-color:rgb(230, 230, 250);
  34. }
  35. main .navigation2 .left a {
  36. border-radius: 20px;
  37. padding:10px 20px;
  38. }
  39. /* 底部左侧 */
  40. main .navigation2 .bottom-left {
  41. display:grid;
  42. grid-template-columns: 100px 1fr;
  43. gap:30px;
  44. }
  45. main .navigation2 .bottom-left .desc {
  46. display:grid;
  47. place-items:center;
  48. padding:16px;
  49. }
  50. main .navigation2 .bottom-left .detail img{
  51. width: 100%;
  52. grid-row: span 2;
  53. }
  54. main .navigation2 .bottom-left .detail {
  55. display: flex;
  56. place-items: center;
  57. place-content: space-between;
  58. }
  59. /* main .navigation2 .bottom-left .detail{
  60. display: grid;
  61. grid-template-columns: repeat(5, 1fr);
  62. place-content: center;
  63. } */
  64. main .navigation2 .bottom-left .detail li {
  65. display:grid;
  66. grid-template-columns: 36px 85px;
  67. gap:0 10px;
  68. place-items:center start;
  69. }
  70. main .navigation2 .bottom-left .detal li a{
  71. font-size:14px;
  72. }
  73. main .navigation2 .bottom-left .detal li a:hover{
  74. color:red;
  75. }
  76. main .navs .bottom-left .detal li span,
  77. main .navs .bottom-left .desc span {
  78. font-size: 12px;
  79. color:#999;
  80. }
  81. /* 右侧导航 */
  82. main .right {
  83. display:grid;
  84. grid-template-rows:142px 1fr;
  85. }
  86. main .right .user{
  87. display:grid;
  88. grid-template-rows: 70px 1fr;
  89. border-bottom:rgb(230, 230, 250) solid 1px;
  90. place-items:center;
  91. }
  92. main .right .user .userID{
  93. display:grid;
  94. grid-template-columns: 40px 75px;
  95. gap:0 20px;
  96. }
  97. button{
  98. background-color:red;
  99. width:150px;
  100. height:34px;
  101. border-radius:20px;
  102. border-width:0;
  103. color:white;
  104. }
  105. main .right .wenda{
  106. display:grid;
  107. grid-template-rows: repeat(6,1fr);
  108. place-items:center start;
  109. padding:0 20px;
  110. }
  111. main .right .wenda .cont1 a{
  112. background-color:red;
  113. color:white;
  114. font-size: smaller;
  115. }
  116. /* 底部右侧 */
  117. main .navigation2 .bottom-right ul{
  118. display:flex;
  119. place-content:center;
  120. gap:20px;
  121. padding:10px;
  122. }
  123. main .navigation2 .bottom-right li{
  124. display:grid;
  125. grid-template-rows: 36px 36px;
  126. }
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