Apply position: sticky to child of a div

后端 未结 4 1847
北荒
北荒 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:33

    Well it is actually working .But the div with class div-sticky-class is inside another div (with class this-parent-div-is-necessary ) that moves. Well if you want it to work you can give the outer div the same class e.g

    Lorem Ipsum
    
    Test
    Lorem Ipsum

提交回复
热议问题