图片上移,

图片上移,

#about部分
   .about{width:100%;
           margin:0 auto;}
     .about .about-top h1{text-align:center;
                      margin-top:50px;}
 .about .string{width:30px;
         height:2px;
               background:#07cbc9;
               margin:0 auto;
      margin-top:10px;}
         .about .about-top .word1{width:420px;
                      font-size:13px;
       font-family:"黑体";
       margin:0 auto;
       margin-top:10px;
       color:#7D7C7F;
       font-style:bold;
       }
      .about .about-middle{width:900px;
                        height:400px;
         margin:0 auto;
       
         margin-top:10px;
         position:relative;
         }
  
   .about .about-middle .middle1{float:left;
                                 position:absolute;
                                font-size:30px;
                                  width:150px;
          height:100px;
                                  font-family:"黑体";
          font-style:bolder;
          margin-left:100px;
          margin-top:30px;
         
         }
    .about .about-middle .middle2 img{float:left;
                                   position:absolute;
                                    width:400px;
            height:300px;
           margin-left:250px;
           margin-top:30px;
               }
     
     .about .about-middle .middle3{width:200px;
                                height:300px;
           background-color:transparent;
           float:right;
           margin-right:20px;
           margin-top:30px;}
    .about .about-middle .middle3 .n-top,.n-bottom{width:200px;
                                         height:100px;
           border:1px solid #07cbc9;}
       .about .about-middle .middle3 .n-bottom{margin-top:20px;}
      .about .about-middle .middle3  h1,p{text-align:center;
                                             margin-top:10px;}
    .clear{clear:both;}
    .about .about-middle .about-left{
                                     width:300px;
                                     height:160px;
          border:1px solid grey;
          margin-left:100px;
          float:left;
          margin-top:130px;
          opacity: 0.5;
                                        z-index:2 ;
           background-color:rgba(255,255,255,.4);
          
                                        }
      .about .about-middle .about-left .word2{margin-left:20px;
                                           z-index: 3;
            font-style:bolder;
           }
   .about .about-middle .about-left button{margin-left:20px;
                                           padding:5px;
             background:black;
             color:white;
             margin-top:15px;}
       .about .about-middle .about-left button:hover{background:transparent;
                                                  color:black;}
  .about .about-bottom{width:100%;
                       height:600px;
        background:yellow;

    margin-top:50px;

     
       } 

 <!--ABOUT区-->
     <div class="about">
  <!--about上面部分-->
  <div class="about-top">
     <h1>ABOUT</h1>
  <div class="string"></div>
  <div class="word1">
   Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
  </div>
  </div>
  <!--about中间部分-->
  <div class="about-middle">
  <div class="middle1">
  A WORD <br />ABOUT  US
  </div>
   <div class="middle2">
   <img src="images/bb3.jpg"/>
  </div>
   <div class="middle3">
   <div class="n-top">
   <h1>70000</h1>
   <div class="string"></div>
   <p>Students</p>
   </div>
   <div class="n-bottom">
   <h1>600</h1>
   <div class="string"></div>
   <p>Faculty</p>
   </div>
   </div>
   <div class="about-left">
   <div class="word2">
   Praesent dignissim viverra est, sed<br/>bibendum ligula congue non. Sed ac nisl<br/>et felis gravida commodo? Suspendisse<br/>eget ullamcorper ipsum. Suspendisse<br/>diam amet.
   </div>
   <button>EXPLORE</button>
   <div class="clear"></div>
   </div>
   <!--about下面部分-->
   <div class="about-bottom">
   <img src="images/b1.jpg">
   <div class="about-bottom1">
   <h1>Library</h1>
   <h2>Lorem Ipsum is simply dummy text of the printing and typesetting industry</h2>
   <h3>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</h3>
   <button>EXPLORE</button>
   </div>
   <img src="images/b2.jpg">
   <div  class="about-bottom2">
   <h1>Computer Lab</h1>
   <h2>Lorem Ipsum is simply dummy text of the printing and typesetting industry</h2>
   <h3>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</h3>
   <button>EXPLORE</button>
   </div>
   <img src="images/b3.jpg">
   <div  class="about-bottom3">
   <h1>Conference Hall</h1>
   <h2>Lorem Ipsum is simply dummy text of the printing and typesetting industry</h2>
   <h3>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</h3>
   <button>EXPLORE</button>
   </div>
   <img src="images/b4.jpg">
   <div class="about-bottom4">
   <h1>Play Ground</h1>
   <h2>Lorem Ipsum is simply dummy text of the printing and typesetting industry</h2>
   <h3>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</h3>
   <button>EXPLORE</button>
   </div>
   </div>

下面图片上移,给about-bottom设置宽高,跑到上面内容里去了

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

2回答
怎么都被占用了呢 2018-03-22 09:27:44

给图片外层套一个div,设置合适的宽度之后,margin:0 auto居中即可。如果还是无法解决,将你修改后的代码完整的放上来吧,方便帮你调试

怎么都被占用了呢 2018-03-21 17:20:31

因为上边的浮动导致,给about-bottom元素添加一个清除浮动clear:both即可。

但是建议该区域如下布局

http://img1.sycdn.imooc.com//climg/5ab222f10001e46108140653.jpg

整个区域划分为3大块,中间的一块,又分为3部分(左、中、右)。给中间的块设置一个合适的宽度后,margin:0 auto水平居中即可。里面的图片定义在正常的文档流中,左右部分绝对定位到要求的位置即可

  • 提问者 helen_papa #1
    我按您说的划分方式划分后,定义中间块的图片时,图片还是无法移到指定位置,前面的我已用了clear
    2018-03-21 21:11:22
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
前端小白入门系列课程
  • 参与学习           人
  • 提交作业       11218    份
  • 解答问题       36713    个

从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师