Apply position: sticky to child of a div

后端 未结 4 1848
北荒
北荒 2020-12-16 12:48

Position: sticky doesn\'t seem to work for me when I apply it to a child of a div. How to solve?

HTML:

Lorem Ipsum
4条回答
  •  佛祖请我去吃肉
    2020-12-16 13:48

    Sticky position only works inside the parent div, your html should be like this:

    Lorem Ipsum
    
    Test
    Lorem ...
    Lorem ...
    Lorem ...
    Lorem ...

    It will works here too

    Won't work here because it's outside the parent of div-sticky-class








    https://jsfiddle.net/n8Le2tva/7/

提交回复
热议问题