Blogger Information
Blog 119
fans 3
comment 1
visits 94532
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
CSS基础定位-PHP培训十期线上班 学号:510251 12月20日作业
赵大叔
Original
873 people have browsed it

CSS基础定位-PHP培训十期线上班 学号:510251 12月20日作业

小白一个,完全跟着老师的代码敲出来的。

1、HTML代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="static/font/iconfont.css">
  6. <title>12月20作业</title>
  7. <style>
  8. * { /*初始化*/
  9. margin:0; /*内边距*/
  10. padding: 0; /*外边距*/
  11. font-size: 13px; /*字体*/
  12. /*outline: 1px dashed red; !*轮廓线条*!*/
  13. }
  14. a { /*字体初始化*/
  15. color: #555;
  16. font-size: 13px;
  17. text-decoration: none; /*下划线去掉,decoration修饰*/
  18. }
  19. /*设置容器样式,少用ID,框架才用ID*/
  20. .index-header { /*.index-header 选择器*/
  21. width: 1200px;
  22. min-height: 300;
  23. margin:30px auto; /*居中*/
  24. }
  25. .index-header > .top{ /* >:子元素; 空格:所有后代元素*/
  26. height: 70px;
  27. position: relative; /*转为定位父级,relative相对定位*/
  28. }
  29. .index-header > .top * { /*统一样式,*表示所有*/
  30. height: inherit; /*inherit继承*/
  31. line-height: 70px; /*垂直居中,设置行高*/
  32. }
  33. /*设置logo*/
  34. .index-header > .top > .logo {
  35. width: 176px;
  36. position: absolute; /*绝对定位*/
  37. top:0; /*logo相对top,左上0*/
  38. left: 0;
  39. }
  40. /*设置搜索框*/
  41. .index-header > .top > .search{
  42. width: 330px;
  43. position: absolute;
  44. top: 0;
  45. right: 350px; /*6个图标,占300px*/
  46. }
  47. /*设置图标*/
  48. .index-header > .top > .quick-start{
  49. width: 300px;
  50. position: absolute;
  51. top: 0;/*quick-start相对top,右上0*/
  52. right: 0;
  53. }
  54. .index-header > .top > .logo img{
  55. height: 100%;
  56. display: block; /*清除下边框*/
  57. }
  58. /*搜索框*/
  59. .index-header > .top > .search >input[type="search"]{ /*选择:input标签+属性*/
  60. width: 330px;
  61. height: 36px;
  62. border-radius: 10px; /*设置圆角*/
  63. padding: 10px;
  64. }
  65. /*放大镜*/
  66. .index-header > .top > .search >input[type="search"]+label{ /*+号表示选择相临元素*/
  67. font-size: 23px;
  68. margin: -30px; /*移动放大镜,支持负值*/
  69. position: relative;
  70. top: 5px;
  71. }
  72. /*鼠标停留:hover*/
  73. .index-header > .top > .search >input[type="search"]:hover{ /*阴影*/
  74. box-shadow: 0 0 5px #888888; /*665,66有偏移*/
  75. }
  76. /*快速入口*/
  77. .index-header > .top>.quick-start>span{
  78. font-size: 33px;
  79. margin-right: 6px;
  80. }
  81. .index-header > .top>.quick-start>span:hover{
  82. color: red;
  83. cursor:pointer;
  84. }
  85. /*导航区*/
  86. .index-header >.nav{
  87. height: 44px;
  88. }
  89. .index-header >.nav> .nav-item{
  90. width: 300px; /*1200/4=300*/
  91. height: inherit; /*继承*/
  92. position: relative; /*转为定位元素*/
  93. float: left; /*左右浮动*/
  94. }
  95. .index-header >.nav> .nav-item>.iconfont{
  96. font-size: 40px;
  97. color: red;
  98. position: absolute;
  99. /*top: ;
  100. left: ;*/
  101. }
  102. .index-header >.nav> .nav-item>.tag{
  103. width: 40px;
  104. position: absolute;
  105. left: 45px; /*5像素间隙*/
  106. border-right: 1px solid #cccccc; /*右边框*/
  107. }
  108. .index-header >.nav> .nav-item>.links{
  109. width: 160px;
  110. position: absolute;
  111. left:95px;
  112. }
  113. .index-header >.nav> .nav-item>.links>a{
  114. margin: 4px;
  115. }
  116. .index-header >.nav> .nav-item>.links>a:hover{
  117. color: red;
  118. }
  119. .index-header>.slider-ads{
  120. height: 320px;
  121. position: relative;
  122. }
  123. .index-header>.slider-ads>.slider{
  124. width: 900px;
  125. position: absolute;
  126. }
  127. .index-header>.slider-ads>.ads{
  128. width: 295px;
  129. position: absolute;
  130. right: 0; /*从右边开始*/
  131. }
  132. .index-header>.slider-ads img{
  133. height: 100%;
  134. display: block;
  135. }
  136. .index-header>*{
  137. margin: 20px 0; /*紧*/
  138. }
  139. </style>
  140. </head>
  141. <body>
  142. <div class="index-header">
  143. <!-- 上:logo+search+incon-->
  144. <div class="top">
  145. <div class="logo">
  146. <a href=""><img src="static/images/logo.png" alt=""></a> <!--链接里放图片-->
  147. </div>
  148. <div class="search">
  149. <input type="search" id="search"><label for="search" class="iconfont icon-jinduchaxun"></label>
  150. <!-- 阿里图标一定要放内联框架里显示,label,class,放大镜图标-->
  151. </div>
  152. <div class="quick-start"> <!--快速入口-->
  153. <span class="iconfont icon-huiyuan1"></span>
  154. <span class="iconfont icon-charutupian"></span>
  155. <span class="iconfont icon-shangyibu"></span>
  156. <span class="iconfont icon-icon_tianjia"></span>
  157. <span class="iconfont icon-huiyuan2"></span>
  158. <span class="iconfont icon-html"></span>
  159. </div>
  160. </div>
  161. <!-- 中:导航,nav-->
  162. <div class="nav">
  163. <div class="nav-item" >
  164. <span class="iconfont icon-DOC"></span> <!--图标;iconfont基础样式-->
  165. <div class="tag">
  166. <span>资讯</span>
  167. <span>学习</span>
  168. </div>
  169. <div class="links">
  170. <a href="">器材</a> <!--ctrl+d,复制-->
  171. <a href="">器材</a>
  172. <a href="">器材</a>
  173. <a href="">器材</a>
  174. <a href="">器材</a>
  175. <a href="">器材</a>
  176. <a href="">飞机</a>
  177. <a href="">其它</a>
  178. </div>
  179. </div>
  180. <div class="nav-item" >
  181. <span class="iconfont icon-DOC"></span>
  182. <div class="tag">
  183. <span>资讯</span>
  184. <span>学习</span>
  185. </div>
  186. <div class="links">
  187. <a href="">器材</a>
  188. <a href="">器材</a>
  189. <a href="">器材</a>
  190. <a href="">器材</a>
  191. <a href="">器材</a>
  192. <a href="">器材</a>
  193. <a href="">器材</a>
  194. <a href="">器材</a>
  195. </div>
  196. </div>
  197. <div class="nav-item" >
  198. <span class="iconfont icon-DOC"></span>
  199. <div class="tag">
  200. <span>资讯</span>
  201. <span>学习</span>
  202. </div>
  203. <div class="links">
  204. <a href="">器材</a>
  205. <a href="">器材</a>
  206. <a href="">器材</a>
  207. <a href="">器材</a>
  208. <a href="">器材</a>
  209. <a href="">器材</a>
  210. <a href="">器材</a>
  211. <a href="">器材</a>
  212. </div>
  213. </div>
  214. <div class="nav-item" >
  215. <span class="iconfont icon-DOC"></span>
  216. <div class="tag">
  217. <span>资讯</span>
  218. <span>学习</span>
  219. </div>
  220. <div class="links">
  221. <a href="">器材</a>
  222. <a href="">器材</a>
  223. <a href="">器材</a>
  224. <a href="">器材</a>
  225. <a href="">器材</a>
  226. <a href="">器材</a>
  227. <a href="">器材</a>
  228. <a href="">器材</a>
  229. </div>
  230. </div>
  231. </div>
  232. <!-- 下:轮播,slider+广告,ads-->
  233. <div class="slider-ads">
  234. <div class="slider">
  235. <a href=""><img src="static/images/1.jpg" alt=""></a>
  236. </div>
  237. <div class="ads">
  238. <a href=""><img src="static/images/banner-right.jpg" alt=""></a>
  239. </div>
  240. </div>
  241. </div>
  242. </body>
  243. </html>

2、布局分析

3、代码分析

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