且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CSS Div时彼此重叠

更新时间:2022-04-29 01:08:49

只是修改了一下你的CSS删除的位置是:固定的,并补充显示:在需要的表芯/表希望这将有助于:

just modified a bit your css remove position:fixed, and added display:table-cell/table where required hope it will help:

   #container {
       width: 100%;
       padding-right: 200px;
       display:table;
   }
   #autowidth {
       width: 80%;
       display:table-cell;
       z-index: 1;
       position: relative;

   }
   #fixed {
       width: 20%;
       z-index: 1;
       display:table-cell;
       margin-right: -200px;

   }

另一个解决办法是删除位置是:固定,并添加盒大小:边界框左,右的div

another solution could be to remove position:fixed and add box-sizing:border-box to left and right divs

#container {
    width: 100%;
    padding-right: 200px;
}
#autowidth {
    width: 80%;
    float: right;
    z-index: 1;
    position: relative;
    box-sizing:border-box;

}
#fixed {
    width: 20%;
    z-index: 1;
    float: left;
    margin-right: -200px;

    box-sizing:border-box;
}