天天看點

CSS實作左右兩邊不同時滾動

css布局,左邊滾動時,右邊不随着滾動,右邊滾動時,左邊不随着滾動

例子截圖:

CSS實作左右兩邊不同時滾動

代碼:

<body>

   <div class="parent">

    <div class="leftChild"></div>

    <div class="rightChild"></div>

  </div>

</body>

body {width: 100%, height: 100%}

.parent {overflow: hidden; position:fixed; top:0; bottom:0; left:0; right:0}

.leftChild {float:left; overflow:auto; width:40%;height: 100%}

.leftChild {float:left; overflow:auto; width:60%; height: 100%}

           

後續還有更好的解決方案,會繼續更新