Home >Web Front-end >CSS Tutorial >How do I create a scrollable HTML table with fixed headers?
Creating a Scrollable HTML Table
In HTML, displaying a vertically scrollable table can be achieved by following these steps:
Here's an example that incorporates these steps:
<div>
In this example, the "table-wrapper" div has a fixed height and an overflow set to "auto," allowing for vertical scrolling. The table headers (thead) have absolute positioning and are fixed at the top while the table body (tbody) contains the scrollable data.
By following these steps, you can create an HTML table that maintains a set size with fixed headers, while allowing the body to scroll for varying amounts of data.
The above is the detailed content of How do I create a scrollable HTML table with fixed headers?. For more information, please follow other related articles on the PHP Chinese website!