博客列表 >position的简单布局(12.20作业)--PHP培训十期线上班

position的简单布局(12.20作业)--PHP培训十期线上班

弃
原创
2019年12月25日 00:19:52775浏览

html代码

  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="./static/font/iconfont.css">
  8. <link rel="stylesheet" href="./work.css">
  9. <title>12月20作业</title>
  10. </head>
  11. <body>
  12. <div class="body">
  13. <div class="top">
  14. <!-- logo -->
  15. <div class="log">
  16. <a href=""><img src="./static/images/logo.png" alt=""></a>
  17. </div>
  18. <!-- input-search -->
  19. <div class="search">
  20. <input type="search" id="search">
  21. <label for="search" class="iconfont icon-jinduchaxun"></label>
  22. </div>
  23. <!-- 快捷导航 -->
  24. <div class="quit-nav">
  25. <em class="iconfont icon-huiyuan1"></em>
  26. <em class="iconfont icon-huiyuan1"></em>
  27. <em class="iconfont icon-huiyuan1"></em>
  28. <em class="iconfont icon-huiyuan1"></em>
  29. <em class="iconfont icon-huiyuan1"></em>
  30. <em class="iconfont icon-huiyuan1"></em>
  31. </div>
  32. </div>
  33. <div class="nav">
  34. <div class="nav-item">
  35. <em class="iconfont icon-DOC"></em>
  36. <div class="nav-item-child1">
  37. <a href=""><span>好好</span></a>
  38. <a href=""><span>学习</span></a>
  39. </div>
  40. <div class="nav-item-child2">
  41. <a href=""><span>好好</span></a>
  42. <a href=""><span>学习</span></a>
  43. <a href=""><span>好好</span></a>
  44. <a href=""><span>学习</span></a>
  45. <a href=""><span>好好</span></a>
  46. <a href=""><span>学习</span></a>
  47. <a href=""><span>好好</span></a>
  48. <a href=""><span>学习</span></a>
  49. </div>
  50. </div>
  51. <div class="nav-item">
  52. <em class="iconfont icon-DOC"></em>
  53. <div class="nav-item-child1">
  54. <a href=""><span>好好</span></a>
  55. <a href=""><span>学习</span></a>
  56. </div>
  57. <div class="nav-item-child2">
  58. <a href=""><span>好好</span></a>
  59. <a href=""><span>学习</span></a>
  60. <a href=""><span>好好</span></a>
  61. <a href=""><span>学习</span></a>
  62. <a href=""><span>好好</span></a>
  63. <a href=""><span>学习</span></a>
  64. <a href=""><span>好好</span></a>
  65. <a href=""><span>学习</span></a>
  66. </div>
  67. </div>
  68. <div class="nav-item">
  69. <em class="iconfont icon-DOC"></em>
  70. <div class="nav-item-child1">
  71. <a href=""><span>好好</span></a>
  72. <a href=""><span>学习</span></a>
  73. </div>
  74. <div class="nav-item-child2">
  75. <a href=""><span>好好</span></a>
  76. <a href=""><span>学习</span></a>
  77. <a href=""><span>好好</span></a>
  78. <a href=""><span>学习</span></a>
  79. <a href=""><span>好好</span></a>
  80. <a href=""><span>学习</span></a>
  81. <a href=""><span>好好</span></a>
  82. <a href=""><span>学习</span></a>
  83. </div>
  84. </div>
  85. <div class="nav-item">
  86. <em class="iconfont icon-DOC"></em>
  87. <div class="nav-item-child1">
  88. <a href=""><span>好好</span></a>
  89. <a href=""><span>学习</span></a>
  90. </div>
  91. <div class="nav-item-child2">
  92. <a href=""><span>好好</span></a>
  93. <a href=""><span>学习</span></a>
  94. <a href=""><span>好好</span></a>
  95. <a href=""><span>学习</span></a>
  96. <a href=""><span>好好</span></a>
  97. <a href=""><span>学习</span></a>
  98. <a href=""><span>好好</span></a>
  99. <a href=""><span>学习</span></a>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="bottom">
  104. <div class="bottom-1">
  105. <img src="./static/images/1.jpg" alt="">
  106. </div>
  107. <div class="bottom-right">
  108. <img src="./static/images/banner-right.jpg" alt="">
  109. </div>
  110. </div>
  111. </div>
  112. </body>
  113. </html>

css代码

  1. /* 初始化 */
  2. *{
  3. margin: 0;
  4. padding: 0;
  5. /* outline: 1px dashed lightcoral; */
  6. }
  7. a{
  8. color: lightgreen;
  9. font-size: 13px;
  10. /* 去掉下划线 */
  11. text-decoration: none;
  12. }
  13. .body{
  14. width: 1200px;
  15. min-height: 300px;
  16. margin: 30px auto;
  17. }
  18. .body > *{
  19. margin-bottom: 20px;
  20. }
  21. /* 最上面的div top */
  22. .body > .top{
  23. height: 70px;
  24. position: relative;
  25. }
  26. .body > .top *{
  27. height: inherit;
  28. line-height: 70px;
  29. }
  30. /* log 图片 */
  31. .body > .top > .log{
  32. width: 176px;
  33. position: absolute;
  34. left:0;
  35. top: 0;
  36. }
  37. /* 搜索框 */
  38. .body > .top > .search{
  39. width: 330px;
  40. position: absolute;
  41. top: 0;
  42. right:350px;
  43. }
  44. .body > .top > .quit-nav{
  45. width: 300px;
  46. position: absolute;
  47. top: 0;
  48. right: 0;
  49. }
  50. .body > .top > .log img{
  51. height: 100%;
  52. display: block;
  53. }
  54. /* 搜索框 */
  55. .body > .top > .search input[type='search']{
  56. width: 330px;
  57. height: 36px;
  58. border-radius: 10px;
  59. padding: 10px;
  60. }
  61. .body > .top > .search input[type='search']:hover{
  62. box-shadow: 0 0 5px rosybrown;
  63. }
  64. .body > .top > .search input[type='search'] + label{
  65. font-size: 24px;
  66. margin-left: -30px;
  67. position: relative;
  68. top: 5px;
  69. right: 10px;
  70. }
  71. .body > .top > .quit-nav > em{
  72. font-size: 35px;
  73. margin-right: 10px;
  74. }
  75. .body > .top > .quit-nav > em:hover{
  76. color:red;
  77. cursor: pointer;
  78. }
  79. /* 中间导航区 */
  80. .body > .nav{
  81. height: 45px;
  82. }
  83. .body > .nav > .nav-item{
  84. width: 300px;
  85. height: inherit;
  86. position: relative;
  87. float: left;
  88. }
  89. .body > .nav > .nav-item em{
  90. color: red;
  91. font-size: 40px;
  92. position: absolute;
  93. }
  94. .body > .nav > .nav-item > .nav-item-child1{
  95. width: 40px;
  96. position: absolute;
  97. left: 46px;
  98. border-right: 1px solid #cccccc;
  99. }
  100. .body > .nav > .nav-item > .nav-item-child2{
  101. width: 160px;
  102. position: absolute;
  103. right:30px;
  104. }
  105. .body > .nav > .nav-item > .nav-item-child2 a{
  106. margin-left: 5px;
  107. }
  108. .body > .nav > .nav-item > .nav-item-child2 a:hover{
  109. color: red;
  110. text-decoration: rosybrown;
  111. }
  112. .body > .bottom {
  113. height: 320px;
  114. position: relative;
  115. }
  116. .body > .bottom > .bottom-1{
  117. width: 895px;
  118. position: absolute;
  119. display: block;
  120. }
  121. .body > .bottom > .bottom-right{
  122. width: 300px;
  123. position: absolute;
  124. display: block;
  125. right:0;
  126. }

效果展示

总结心得

  1. 在老师没有讲布局之前,自己对布局大概就是一塌糊涂,只知道一点零零散散的知识点,老师讲完之后,心里大概有一个布局的大致思路, 1、先将页面总体的大架子搭出来; 2、在把架子中的小架子搭建出来 3、在对小架子里面的东西进行样式调整。
  2. 感觉对前端的反感,渐渐没有了。

谢谢老师。

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议