Blogger Information
Blog 4
fans 0
comment 0
visits 2249
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
12.20作业网页传统布局
天津饭
Original
645 people have browsed it

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <link rel="stylesheet" href="12.23课程源码/1223/static/font/iconfont.css">
  7. <style>
  8. *{
  9. font-size:20px;
  10. /*outline:1px dashed palevioletred;*/
  11. }
  12. .index-header{
  13. width:1500px;
  14. height:1000px;
  15. margin:50px auto;
  16. }
  17. .index-header>.top{
  18. height:70px;
  19. position:relative;
  20. }
  21. .index-header>.top*{
  22. height:inherit;
  23. line-height:100px;
  24. }
  25. .index-header>.top>.logo{
  26. width:250px;
  27. position:absolute;
  28. top:0;
  29. left:0;
  30. }
  31. .index-header>.top>.search{
  32. width:300px;
  33. position:absolute;
  34. right:450px;
  35. top:15px
  36. }
  37. .index-header>.top>.quick{
  38. width:400px;
  39. position:absolute;
  40. right:0;
  41. top:30px;
  42. }
  43. .index-header>.top>.search>input[type="search"]{
  44. width:300px;
  45. height:33px;
  46. border-radius:8px;
  47. }
  48. .index-header>.top>.search>input[type="search"]+label{
  49. font-size:30px;
  50. margin:-30px;
  51. position: relative;
  52. top:5px;
  53. right:10px
  54. }
  55. .index-header>.nav {
  56. height: 50px;
  57. }
  58. .index-header>.nav >.nav-item{
  59. width:350px;
  60. height:80px;
  61. position:relative;
  62. float:left;
  63. }
  64. .index-header>.nav >.nav-item >.iconfont{
  65. font-size:50px;
  66. color:rebeccapurple;
  67. position:absolute;
  68. }
  69. .index-header>.nav .nav-item .tag{
  70. width: 50px;
  71. position:absolute;
  72. left:65px;
  73. border-right:1px solid palevioletred;
  74. }
  75. .index-header>.nav .nav-item .links{
  76. width:300px;
  77. position:absolute;
  78. left:120px;
  79. }
  80. .index-header>.nav >.nav-item>.links>a:hover{
  81. color:lightgreen;
  82. }
  83. .index-header>.slider-ads{
  84. height:500px;
  85. position:relative;
  86. }
  87. .index-header>.slider-ads>.slider{
  88. width:900px;
  89. position:absolute;
  90. top:100px;
  91. }
  92. .index-header>.slider-ads>.ads{
  93. width:200px;
  94. position:absolute;
  95. top:100px;
  96. right:200px;
  97. }
  98. </style>
  99. </head>
  100. <body>
  101. <div class="index-header">
  102. <div class="top">
  103. <div class="logo">
  104. <a href="https://www.php.cn"><img src="12.23课程源码/1223/static/images/logo.png"></a>
  105. </div>
  106. <div class="search">
  107. <input type="search" id="search"><label for="search" class="iconfont icon-icon_group"></label>
  108. </div>
  109. <div class="quick">
  110. <span class="iconfont icon-icon_group"></span>
  111. <span class="iconfont icon-icon_group"></span>
  112. <span class="iconfont icon-icon_group"></span>
  113. <span class="iconfont icon-icon_group"></span>
  114. <span class="iconfont icon-icon_group"></span>
  115. <span class="iconfont icon-icon_group"></span>
  116. </div>
  117. </div>
  118. <div class="nav">
  119. <div class="nav-item">
  120. <span class="iconfont icon-DOC"></span>
  121. <div class="tag">
  122. <span>咨询</span>
  123. <span>课程</span>
  124. </div>
  125. <div class="links">
  126. <a href="">语文</a>
  127. <a href="">数学</a>
  128. <a href="">英语</a>
  129. <a href="">政治</a>
  130. <a href="">历史</a>
  131. <br>
  132. <a href="">生物</a>
  133. <a href="">汉语</a>
  134. <a href="">地理</a>
  135. <a href="">美语</a>
  136. <a href="">法语</a>
  137. </div>
  138. </div>
  139. <div class="nav-item">
  140. <span class="iconfont icon-DOC"></span>
  141. <div class="tag">
  142. <span>咨询</span>
  143. <span>课程</span>
  144. </div>
  145. <div class="links">
  146. <a href="">语文</a>
  147. <a href="">数学</a>
  148. <a href="">英语</a>
  149. <a href="">政治</a>
  150. <a href="">历史</a>
  151. <br>
  152. <a href="">生物</a>
  153. <a href="">汉语</a>
  154. <a href="">地理</a>
  155. <a href="">美语</a>
  156. <a href="">法语</a>
  157. </div>
  158. </div>
  159. <div class="nav-item">
  160. <span class="iconfont icon-DOC"></span>
  161. <div class="tag">
  162. <span>咨询</span>
  163. <span>课程</span>
  164. </div>
  165. <div class="links">
  166. <a href="">语文</a>
  167. <a href="">数学</a>
  168. <a href="">英语</a>
  169. <a href="">政治</a>
  170. <a href="">历史</a>
  171. <br>
  172. <a href="">生物</a>
  173. <a href="">汉语</a>
  174. <a href="">地理</a>
  175. <a href="">美语</a>
  176. <a href="">法语</a>
  177. </div>
  178. </div>
  179. <div class="nav-item">
  180. <span class="iconfont icon-DOC"></span>
  181. <div class="tag">
  182. <span>咨询</span>
  183. <span>课程</span>
  184. </div>
  185. <div class="links">
  186. <a href="">语文</a>
  187. <a href="">数学</a>
  188. <a href="">英语</a>
  189. <a href="">政治</a>
  190. <a href="">历史</a>
  191. <br>
  192. <a href="">生物</a>
  193. <a href="">汉语</a>
  194. <a href="">地理</a>
  195. <a href="">美语</a>
  196. <a href="">法语</a>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="slider-ads">
  201. <div class="slider">
  202. <a href=""><img src="12.26/images/1.jpg" alt=""></a>
  203. </div>
  204. <div class="ads">
  205. <a href=""><img src="12.26/images/banner-right.jpg" alt=""></a>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. </body>
  211. </html>

感觉有点乱#关于定位父级

意思是在这个.index-header>.slider-ads盒子中把css代码写成 `position:relative;就是把slider-ads这个盒子定位为父级了吗

下面两个子元素写上position:absolute后,子元素位置的移动是相对于刚才定位的父元素做出改变

  1. .index-header>.slider-ads{
  2. height:500px;
  3. position:relative;
  4. }
  5. .index-header>.slider-ads>.slider{
  6. width:900px;
  7. position:absolute;
  8. top:100px;
  9. }
  10. .index-header>.slider-ads>.ads{
  11. width:200px;
  12. position:absolute;
  13. top:100px;
  14. right:200px;
  15. }
Correcting teacher:天蓬老师天蓬老师

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