Solution: use position: sticky to create a dynamic top sucking effect:

Examples are as follows:

1 Before scrolling up the page:

2 After scrolling up the page:

In This way, the elements in the “This is TAB Main” section can always remain at the top of the page window.

3 Specific code: this code is actually implemented by position: sticky, top: xx (threshold) : add these two attributes to the elements that want to achieve the top effect.

Reference: www.ruanyifeng.com/blog/2019/1…