How does table realize that the header thead scrolls horizontally with the body tbody?

the width of table is not fixed, and when the header content of table is very long, the page cannot be put down and needs to be scrolled horizontally, but now it can only be scrolled by tbody itself. I hope the header can also scroll along with the body of the table. Do you have any good ways to implement it?

Dec.01,2021

such an effect?
https://codepen.io/ars_qu/pen.


table wrap a div, around and then set overflow-x: auto, not to scroll the entire table


js to move the header.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e90946-470af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e90946-470af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?