Blogger Information
Blog 4
fans 0
comment 0
visits 2277
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
前端学习-1220号作业
Original
692 people have browsed it

1220号作业

效果图展示
终于是完成了一次作业,之前的作业后面会慢慢补上

  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. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <link rel="stylesheet" href="D:\phpstudy_pro\WWW\static\font\iconfont.css">
  8. <!-- <link rel="stylesheet" href="D:\phpstudy_pro\WWW\chapter1\1220zuoye.css"> -->
  9. <style media="screen">
  10. /* 初始化 */
  11. *{
  12. margin: 0;
  13. padding: 0;
  14. font-size: 14px;
  15. /* 添加一个轮廓线 */
  16. /* outline: 1px dashed red; */
  17. }
  18. /* A 标签需要单独设置字体和颜色 */
  19. a {
  20. color: #555;
  21. font-size: 13px;
  22. /* 下划线去掉 */
  23. text-decoration: none;
  24. }
  25. /* 容器,大盒子,ID能不用就不用,尽可能用class */
  26. .index-header{
  27. width: 1200px;
  28. min-height: 300px;
  29. margin: 30px auto;
  30. }
  31. /* 父级类 后买要是空格,则是选择所有下级类 */
  32. .index-header > .logo-search-quickly{
  33. height: 70px;
  34. /* 绝对定位,相对于他的父级元素定位, */
  35. /* 相对定位,相对于元素其本身 */
  36. /* 固定,则是相对于整个html文档。 */
  37. /* 转为定位元素 */
  38. position: relative;
  39. }
  40. /* 统一样式 */
  41. .index-header > .logo-search-quickly * {
  42. /* 默认和父元素一致 */
  43. height: inherit;
  44. /* 设置行高,就可以使得行内元素垂直居中 */
  45. line-height: 70px;
  46. }
  47. /* logo */
  48. .index-header > .logo-search-quickly > .logo {
  49. width: 170px;
  50. position: absolute;
  51. /* 默认值,可省略 */
  52. top: 0;
  53. left: 0;
  54. }
  55. .index-header > .logo-search-quickly > .search {
  56. width: 330px;
  57. position: absolute;
  58. /* 默认值,可省略 */
  59. right: 350px;
  60. }
  61. .index-header > .logo-search-quickly > .quickly {
  62. width: 300px;
  63. position: absolute;
  64. /* 默认值,可省略 */
  65. right: 0;
  66. }
  67. .index-header > .logo-search-quickly > .logo img {
  68. /* 自适应,响应式图片 */
  69. height: 100%;
  70. /* 这里添加图片有,有个bug,图片底部有白边,需要设置为块元素 */
  71. display: block;
  72. }
  73. .index-header > .logo-search-quickly > .search > input[type="search"] {
  74. width: 330px;
  75. height: 36px;
  76. border-radius: 10px;
  77. padding: 10px;
  78. }
  79. /* 放大镜图标,加号,选择相邻元素 */
  80. .index-header > .logo-search-quickly > .search > input[type="search"]+label {
  81. /* 放大镜是字体图标 */
  82. font-size: 23px;
  83. margin-left: -30px;
  84. position: relative;
  85. top: 5px;
  86. }
  87. .index-header > .logo-search-quickly > .quickly > a {
  88. font-size: 33px;
  89. margin-left: 6px;
  90. }
  91. .index-header > .logo-search-quickly > .quickly > a:hover {
  92. color: red;
  93. /* 设置鼠标样式 */
  94. cursor: pointer;
  95. }
  96. .index-header > .logo-search-quickly > .search > input[type="search"]:hover{
  97. box-shadow: 6px 6px 5px #888888
  98. }
  99. /* 中间导航区 */
  100. .index-header > .main-nav{
  101. height: 44px;
  102. }
  103. .index-header > .main-nav > .nav-deatail{
  104. width: 300px;
  105. height: inherit;
  106. /* 转为定位元素,父级 */
  107. position: relative;
  108. float: left;
  109. }
  110. .index-header > .main-nav > .nav-deatail > .pic > .iconfont{
  111. font-size: 40px;
  112. color: red;
  113. position: absolute;
  114. }
  115. .index-header > .main-nav > .nav-deatail > .pic > .tag{
  116. width: 40px;
  117. position: absolute;
  118. left: 45px;
  119. border-right: 1px solid #cccccc;
  120. }
  121. .index-header > .main-nav > .nav-deatail > .links{
  122. width: 120px;
  123. position: absolute;
  124. left: 95px;
  125. }
  126. .index-header > .main-nav > .nav-deatail > .links a:hover{
  127. color: red;
  128. }
  129. .index-header > .banner {
  130. height: 320px;
  131. position: relative;
  132. }
  133. .index-header > .banner > .slider {
  134. width: 900px;
  135. position: absolute;
  136. }
  137. .index-header > .banner > .ads {
  138. width: 295px;
  139. position: absolute;
  140. right: 0;
  141. }
  142. .index-header > .banner img {
  143. height: 100%;
  144. display: block;
  145. }
  146. </style>
  147. <title>12月20日作业</title>
  148. </head>
  149. <div class="index-header">
  150. <div class="logo-search-quickly">
  151. <div class="logo">
  152. <a href=""><img src="D:\phpstudy_pro\WWW\static\images\logo.png" alt=""></a>
  153. </div>
  154. <div class="search">
  155. <input type="search" name="search" id="search">
  156. <label for="search" class="iconfont icon-jinduchaxun"></label>
  157. </div>
  158. <div class="quickly">
  159. <a href="" class="iconfont icon-huiyuan1"></a>
  160. <a href="" class="iconfont icon-danmu1"></a>
  161. <a href="" class="iconfont icon-fabu"></a>
  162. <a href="" class="iconfont icon-fangda"></a>
  163. <a href="" class="iconfont icon-huiyuan2"></a>
  164. <a href="" class="iconfont icon-dianzan"></a>
  165. </div>
  166. </div>
  167. <div class="main-nav">
  168. <div class="nav-deatail">
  169. <div class="pic">
  170. <span class="iconfont icon-gongdan"></span>
  171. <div class="tag">
  172. <span>资讯</span>
  173. <span>学习</span>
  174. </div>
  175. </div>
  176. <div class="links">
  177. <a href="">器材</a>
  178. <a href="">大师</a>
  179. <a href="">学院</a>
  180. <a href="">实战</a>
  181. <a href="">大赛</a>
  182. <a href="">裤子</a>
  183. <a href="">影视</a>
  184. <a href="">其它</a>
  185. </div>
  186. </div>
  187. <div class="nav-deatail">
  188. <div class="pic">
  189. <span class="iconfont icon-renwujincheng"></span>
  190. <div class="tag">
  191. <span>爱好</span>
  192. <span>姐妹</span>
  193. </div>
  194. </div>
  195. <div class="links">
  196. <a href="">油品</a>
  197. <a href="">飞机</a>
  198. <a href="">图片</a>
  199. <a href="">喝水</a>
  200. <a href="">坦克</a>
  201. <a href="">气球</a>
  202. <a href="">毛虾</a>
  203. <a href="">大侠</a>
  204. </div>
  205. </div>
  206. <div class="nav-deatail">
  207. <div class="pic">
  208. <span class="iconfont icon-gongdan"></span>
  209. <div class="tag">
  210. <span>软件</span>
  211. <span>技能</span>
  212. </div>
  213. </div>
  214. <div class="links">
  215. <a href="">学习</a>
  216. <a href="">爱国</a>
  217. <a href="">敬业</a>
  218. <a href="">友善</a>
  219. <a href="">明主</a>
  220. <a href="">富强</a>
  221. <a href="">和平</a>
  222. <a href="">正义</a>
  223. </div>
  224. </div>
  225. <div class="nav-deatail">
  226. <div class="pic">
  227. <span class="iconfont icon-gongdan"></span>
  228. <div class="tag">
  229. <span>编程</span>
  230. <span>美女</span>
  231. </div>
  232. </div>
  233. <div class="links">
  234. <a href="">吃饭</a>
  235. <a href="">睡觉</a>
  236. <a href="">合肥</a>
  237. <a href="">北京</a>
  238. <a href="">杭海</a>
  239. <a href="">云南</a>
  240. <a href="">西安</a>
  241. <a href="">天津</a>
  242. </div>
  243. </div>
  244. </div>
  245. <div class="banner">
  246. <div class="slider">
  247. <a href=""><img src="D:\phpstudy_pro\WWW\static\images\2.jpg" alt=""></a>
  248. </div>
  249. <div class="ads">
  250. <a href=""><img src="D:\phpstudy_pro\WWW\static\images\banner-right.jpg" alt=""></a>
  251. </div>
  252. </div>
  253. </div>
  254. <body>
  255. </body>
  256. </html>

*完成作业的时候,遇到一个问题,就是广告图片在加上css之后,就一直会超出index-header的范围,且加上

  1. right:0;

的时候,广告图片一直居右,最后费了好长时间,各种修改,各种尝试,在调试的时候,发现banner类的css一直没有生效,随即检查css代码是,发现上面多了一个

  1. }

修改之后,就完全正常了。第一次学习的时候,还是很有必要跟着老师的思路,一步步完成,多写几次,慢慢就有感觉了。

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