Blogger Information
Blog 5
fans 1
comment 0
visits 4775
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
标准盒模型和弹性盒模型仿PHP中文网导航
自带光芒
Original
520 people have browsed it

1、标准盒模型

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>标准盒</title>
  7. <style>
  8. body{background:#fff; font-size:14px; font-family:"microsoft yahei",Verdana, Arial; line-height:150%; margin:5px 0 0 0; padding:0; color:#000;}
  9. div{margin:0 auto; padding:0;}
  10. h1,h2,h3,h4,h5,h6,ul,li,dl,dt,dd,form,img,p{
  11. margin:0; padding:0; border:none; list-style-type:none;
  12. }
  13. a{color:#000;text-decoration: none;}
  14. .clearfix:after{content:"."; display:block; height:0; clear:both;visibility:hidden;}
  15. *html .clearfix{height:1%;}
  16. *+html .clearfix{height:1%;}
  17. @font-face {
  18. font-family: "iconfont"; /* Project id */
  19. src: url('iconfont.ttf?t=1637035149022') format('truetype');
  20. }
  21. .iconfont {
  22. font-family: "iconfont" !important;
  23. font-size: 16px;
  24. font-style: normal;
  25. -webkit-font-smoothing: antialiased;
  26. -moz-osx-font-smoothing: grayscale;
  27. }
  28. .icon-gengduo:before {
  29. content: "\ec1c";
  30. }
  31. .icon-xiajiantou:before {
  32. content: "\e629";
  33. }
  34. .fl{
  35. float: left;
  36. }
  37. .headerbox{
  38. width: 100%;
  39. height: 60px;
  40. background: #fff;
  41. box-shadow: 0 4px 8px 0 rgba(7,17,27,.1);
  42. }
  43. .container{
  44. width: 1200px;
  45. margin: 0 auto;
  46. }
  47. .logo{
  48. width: 140px;
  49. height: 60px;
  50. }
  51. .logo img{
  52. max-width: 140px;
  53. max-height: 60px;
  54. }
  55. .navbox{
  56. margin-left: 20px;
  57. }
  58. .navbox li{
  59. float: left;
  60. position: relative;
  61. line-height: 60px;
  62. }
  63. .navbox>ul>li>a{
  64. display: block;
  65. padding:0 20px;
  66. font-size: 15px;
  67. }
  68. .navbox>ul>li a:hover{
  69. color:#f00;
  70. }
  71. .navbox>ul>li>a>span{
  72. padding-left: 5px;
  73. }
  74. .navbox>ul>li.more .iconfont{
  75. font-size: 18px;
  76. font-weight: bold;
  77. }
  78. .navbox .childbox{
  79. display: none;
  80. position:absolute;
  81. left:0;
  82. top:60px;
  83. width: 120px;
  84. background: #fff;
  85. box-shadow: 0 2px 4px rgba(0,0,0,.12);
  86. padding: 5px 0;
  87. }
  88. .navbox .childbox .child_item{
  89. height: 35px;
  90. line-height: 35px;
  91. padding: 0 20px;
  92. }
  93. .navbox>ul>li:hover .childbox{
  94. display: block;
  95. }
  96. </style>
  97. </head>
  98. <body>
  99. <div class="headerbox">
  100. <div class="container clearfix">
  101. <div class="logo fl">
  102. <a href="./"><img src="images/PHPlogo.png" alt="名称" /></a>
  103. </div>
  104. <div class="navbox fl">
  105. <ul>
  106. <li><a href="#">首页</a></li>
  107. <li>
  108. <a href="#">视频教程<span class="iconfont icon-xiajiantou"></span></a>
  109. <div class="childbox">
  110. <div class="child_item">
  111. <a href="#">视频课程</a>
  112. </div>
  113. <div class="child_item">
  114. <a href="#">直播课程</a>
  115. </div>
  116. </div>
  117. </li>
  118. <li>
  119. <a href="#">学习路径<span class="iconfont icon-xiajiantou"></span></a>
  120. <div class="childbox">
  121. <div class="child_item">
  122. <a href="#">入门教程1</a>
  123. </div>
  124. <div class="child_item">
  125. <a href="#">入门教程2</a>
  126. </div>
  127. </div>
  128. </li>
  129. <li><a href="#">大前端</a></li>
  130. <li><a href="#">资源下载</a></li>
  131. <li><a href="#">技术文章</a></li>
  132. <li><a href="#">社区</a></li>
  133. <li class="more">
  134. <a href="#"><span class="iconfont icon-gengduo"></span></a>
  135. <div class="childbox">
  136. <div class="child_item">
  137. <a href="#">编程词典</a>
  138. </div>
  139. <div class="child_item">
  140. <a href="#">APP下载</a>
  141. </div>
  142. </div>
  143. </li>
  144. </ul>
  145. </div>
  146. </div>
  147. </div>
  148. </body>
  149. </html>

2、弹性盒模型

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>弹性盒</title>
  7. <style>
  8. body{background:#fff; font-size:14px; font-family:"microsoft yahei",Verdana, Arial; line-height:150%; margin:5px 0 0 0; padding:0; color:#000;}
  9. div{margin:0 auto; padding:0;}
  10. h1,h2,h3,h4,h5,h6,ul,li,dl,dt,dd,form,img,p{
  11. margin:0; padding:0; border:none; list-style-type:none;
  12. }
  13. a{color:#000;text-decoration: none;}
  14. .clearfix:after{content:"."; display:block; height:0; clear:both;visibility:hidden;}
  15. *html .clearfix{height:1%;}
  16. *+html .clearfix{height:1%;}
  17. @font-face {
  18. font-family: "iconfont"; /* Project id */
  19. src: url('iconfont.ttf?t=1637035149022') format('truetype');
  20. }
  21. .iconfont {
  22. font-family: "iconfont" !important;
  23. font-size: 16px;
  24. font-style: normal;
  25. -webkit-font-smoothing: antialiased;
  26. -moz-osx-font-smoothing: grayscale;
  27. }
  28. .icon-gengduo:before {
  29. content: "\ec1c";
  30. }
  31. .icon-xiajiantou:before {
  32. content: "\e629";
  33. }
  34. .headerbox{
  35. display:flex;
  36. height: 60px;
  37. background: #fff;
  38. box-shadow: 0 4px 8px 0 rgba(7,17,27,.1);
  39. }
  40. .logo{
  41. flex-grow: 1;
  42. height: 60px;
  43. text-align: center;
  44. }
  45. .logo img{
  46. max-width: 100%;
  47. max-height: 60px;
  48. }
  49. .navbox{
  50. flex-grow: 3;
  51. }
  52. .navbox ul{
  53. display:flex;
  54. }
  55. .navbox li{
  56. flex-grow: 1;
  57. position: relative;
  58. line-height: 60px;
  59. }
  60. .navbox>ul>li>a{
  61. display: block;
  62. padding:0 20px;
  63. font-size: 15px;
  64. }
  65. .navbox>ul>li a:hover{
  66. color:#f00;
  67. }
  68. .navbox>ul>li>a>span{
  69. padding-left: 5px;
  70. }
  71. .navbox>ul>li.more .iconfont{
  72. font-size: 18px;
  73. font-weight: bold;
  74. }
  75. .navbox .childbox{
  76. display: none;
  77. position:absolute;
  78. left:0;
  79. top:60px;
  80. width: 120px;
  81. background: #fff;
  82. box-shadow: 0 2px 4px rgba(0,0,0,.12);
  83. padding: 5px 0;
  84. }
  85. .navbox .childbox .child_item{
  86. height: 35px;
  87. line-height: 35px;
  88. padding: 0 20px;
  89. }
  90. .navbox>ul>li:hover .childbox{
  91. display: block;
  92. }
  93. </style>
  94. </head>
  95. <body>
  96. <div class="headerbox">
  97. <div class="logo">
  98. <a href="./"><img src="images/PHPlogo.png" alt="名称" /></a>
  99. </div>
  100. <div class="navbox">
  101. <ul>
  102. <li><a href="#">首页</a></li>
  103. <li>
  104. <a href="#">视频教程<span class="iconfont icon-xiajiantou"></span></a>
  105. <div class="childbox">
  106. <div class="child_item">
  107. <a href="#">视频课程</a>
  108. </div>
  109. <div class="child_item">
  110. <a href="#">直播课程</a>
  111. </div>
  112. </div>
  113. </li>
  114. <li>
  115. <a href="#">学习路径<span class="iconfont icon-xiajiantou"></span></a>
  116. <div class="childbox">
  117. <div class="child_item">
  118. <a href="#">入门教程1</a>
  119. </div>
  120. <div class="child_item">
  121. <a href="#">入门教程2</a>
  122. </div>
  123. </div>
  124. </li>
  125. <li><a href="#">大前端</a></li>
  126. <li><a href="#">资源下载</a></li>
  127. <li><a href="#">技术文章</a></li>
  128. <li><a href="#">社区</a></li>
  129. <li class="more">
  130. <a href="#"><span class="iconfont icon-gengduo"></span></a>
  131. <div class="childbox">
  132. <div class="child_item">
  133. <a href="#">编程词典</a>
  134. </div>
  135. <div class="child_item">
  136. <a href="#">APP下载</a>
  137. </div>
  138. </div>
  139. </li>
  140. </ul>
  141. </div>
  142. </div>
  143. </body>
  144. </html>
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