Position Absolute + Scrolling

后端 未结 4 1916
挽巷
挽巷 2020-12-07 13:40

With the following HTML and CSS

4条回答
  •  醉话见心
    2020-12-07 14:17

    So gaiour is right, but if you're looking for a full height item that doesn't scroll with the content, but is actually the height of the container, here's the fix. Have a parent with a height that causes overflow, a content container that has a 100% height and overflow: scroll, and a sibling then can be positioned according to the parent size, not the scroll element size. Here is the fiddle: http://jsfiddle.net/M5cTN/196/

    and the relevant code:

    html:

    Lorem ipsum ...

    css:

    .container{
      height: 256px;
      position: relative;
    }
    .inner{
      height: 100%;
      overflow: scroll;
    }
    .full-height{
      position: absolute;
      left: 0;
      width: 20%;
      top: 0;
      height: 100%;
    }
    

提交回复
热议问题