Two divs scrolling independently

后端 未结 2 537
借酒劲吻你
借酒劲吻你 2021-02-07 20:28


I need help to make these two

\'s (#side-nav and #content-wrapper) to scroll independently,

HTML:



        
2条回答
  •  时光取名叫无心
    2021-02-07 21:17

    I believe this works for your issue

       body{
          margin:0px;
        }
        #top-nav {
          position: fixed;
          top: 0;
          height: 10vh;
          width: 100%;
          background-color: green;
        }
        #wrapper {
          width: 100%;
          background-color: #fff;
        }
    
        #side-nav {
          float:left;
          width: 250px;
          height: 90vh;
          overflow-y: scroll;
          background-color: red;
        }
    
        #content-wrapper {
          margin: 10vh 0 0 250px;
          padding: 0 30px;
          overflow-y: scroll;
          background-color: blue;
          height:90vh;
        }
    

提交回复
热议问题