When the table header is fixed, it needs to be divided into two tables: one part is thead and the other part is tbody. The specific implementation is as follows: HTML code: <div class="table_box_big"> <div class="table_box"> <table> <thead> <tr> <th><div>Title 1</div></th> <th><div>Title 2</div></th> <th><div>Title Three</div></th> <th><div>Title Title Title Title Title Title Title Title Title Title 4</div></th> <th><div>Title Title Title Title Title Title Title Title Title Title Five</div></th> <th><div>Title Title Title Title Title Title Title Title Title Title Six</div></th> </tr> </thead> </table> <div class="table_tbody_box"> <table> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> <tr> <td>Information 1</td> <td>Information 2</td> <td>Information Three</td> <td>Information Information Information Information Information Information Information Information Information Four</td> <td>Information Information Information Information Information Information Information Information Information Five</td> <td>Information information information information information information information information information information six</td> </tr> </table> </div> </div> CSS style: .table_box_big { overflow-x: scroll; overflow-y: hidden; position: relative; height: 350px; } .table_box { overflow: hidden; position: absolute; } .table_tbody_box { height: 300px; overflow: scroll; } table { border: 1px solid #eeeeee; } table thead tr th { width: 80px; height: 50px; border-right: 1px solid #eeeeee; text-align: center; word-break: keep-all; padding: 2px 10px; background: skyblue; } table tbody tr td { width: 80px; height: 50px; border-right: 1px solid #eeeeee; text-align: center; border-bottom: 1px solid #eeeeee; word-break: keep-all; padding: 2px 10px; } The effect is as follows: This is the end of this article about the fixed header of the table in html and the tbody of the table can slide up, down, left and right. For more relevant content about the fixed header of the table in html, please search the previous articles of 123WORDPRESS.COM or continue to browse the related articles below. I hope that everyone will support 123WORDPRESS.COM in the future! |
<<: Detailed explanation of the difference between adaptive and responsive analysis in vernacular
>>: Can CSS be used like this? The art of whimsical gradients
I am going to review Java these two days, so I wr...
1. Record several methods of centering the box: 1...
Two problems that are easy to encounter when inst...
1. Yum installation yum install subversion 2. Con...
Preface When installing the executable file of a ...
This article example shares the specific code of ...
Here, clever use of CSS techniques allows you to g...
In Google Chrome, after successful login, Google ...
1. Check the character set of MySQL show variable...
This article example shares the specific code of ...
When threads execute concurrently, we need to ens...
background The interface domain name is not hard-...
Benefits of a programmatic approach 1. Global con...
Table of contents Preface start Preface The defau...
Table of contents Preface: Result: 1. Polymerizat...