How can I make the contents of a fixed element scrollable only when it exceeds the height of the viewport?

后端 未结 9 554
别跟我提以往
别跟我提以往 2020-12-01 00:24

I have a div positioned fixed on the left side of a web page, containing menu and navigation links. It has no height set from css, the content dete

9条回答
  •  时光说笑
    2020-12-01 00:59

    You probably need an inner div. With css is:

    .fixed {
       position: fixed;
       top: 0;
       left: 0;
       bottom: 0;
       overflow-y: auto;
       width: 200px; // your value
    }
    .inner {
       min-height: 100%;
    }
    

提交回复
热议问题