问答详情
源自:13-9 Relative与Absolute组合使用

在12-9这个案例中如何让div3和div4的上下间距为0呢?

在div3和div4是父子关系的情况下

http://img.mukewang.com/5794b21d000130f602570332.jpg

实现这种效果,注意不是第二张图那种


谢谢..

http://img.mukewang.com/5794dc740001fea802570224.jpg我不想要这一种效果,想要第一张图那种,谢谢..


提问者:慕粉18764815087 2016-07-24 19:56

个回答

  • hylobates
    2016-07-24 23:09:13

    #box3{

        width:200px;

        height:200px;

        position:relative;       

    }

    #box4{

        width:200px;

         position:absolute;

        bottom:0;

        border-left:0;

        border-bottom:0;

    }

    在我电脑上效果完美,你可以试一下。

  • 沙漏01234567
    2016-07-24 20:42:50

    #box3{

        position:relative;

         width:200px;
        height:200px;
       
    }
    #box4{
        position:absolute;
        top:200px;
        width:200px;
    }

  • 一生ChengNuo
    2016-07-24 20:16:31

    你可以在box4的style里面将它的上边框设置0像素 可以达到那个效果但是不太美观

  • weibo_放荏的蓓影baby_03647355
    2016-07-24 20:15:25

    #box3{

    width: 200px;

    height: 200px;

    position:relative;

    }

    #box4{

    position:absulote;

    bottom:0px;

    width:99%;

    }


  • blooklyn96
    2016-07-24 20:11:14

    #box3{
        width:200px;
        height:200px;
        position:relative;       
    }
    #box4{
        width:99%;
         position:absolute;    
        bottom:0px;
        
    }