How can position absolute scroll with the page!

< tr >
< td > <% = I% > < / td >
< td > < input type= "checkbox" class= "checkbox" value= "<% = I% >" > < / td >
< td > C20180712001 < / td >
< td > Shanghai Wanxiang Automobile Manufacturing Co., Ltd. < / td >
< td >

< td > <% = date ()% > < / td > < td >

Save scroll down, div position
clipboard.png

div
clipboard.png

how to change css to make div scroll with the scroll bar.

Css
Mar.28,2021

is it useless for you to set position:relative for the parent element?


so far, no one has been found to achieve this effect only through CSS, but there are other general implementation ideas:

assume that the element

is x from the top scrolling height, and the scrolling height of the listening browser:

  1. when the scrolling height of the browser is greater than or equal to x , set the css of this element to position: fix; top: 0
  2. restore the browser when its scrolling height is less than x .

the following is the JQuery code:

.xxx.fix {
    position: fixed;
    top: 0;
}
Menu