Home >Web Front-end >CSS Tutorial >How Can I Make an HTML Table Horizontally Scrollable?
Achieving Scrollable HTML Tables: A Guide to Horizontal Scrollbars
Adding both vertical and horizontal scrollbars to an HTML table can initially seem elusive. However, by understanding the fundamental CSS styles, it becomes a straightforward process.
Making the Table Scrollable Horizontally
To enable horizontal scrolling, the following steps are crucial:
Here's an example:
table { display: block; overflow-x: auto; white-space: nowrap; }
Additional Considerations
Cell Height Mismatch: Sometimes, table cells might not fill the table entirely, requiring the following additional CSS:
table tbody { display: table; width: 100%; }
The above is the detailed content of How Can I Make an HTML Table Horizontally Scrollable?. For more information, please follow other related articles on the PHP Chinese website!