Content responsiveness is an essential factor for any documentation. And tables can be hard to handle with the responsive design. There are a lot of things that influence the minimum width of the cell and the table, such as: the actual content minimum width, the paddings, the margins, the content styles, inline styles, etc. And probably, most of the tables won't fit the width of mobile devices, no matter how responsive they are. But what to do if it is necessary to use tables in your docs?
There are a lot of guides over the web, like this one: Responsive Data Tables | CSS-Tricks. They can help you achieve a more responsive table. But it is possible to make wide tables readable even on screens with small widths with minimum effort.
How To Implement
Add the overflow-x: auto; and display: block; declarations to the CSS rule for your table from the project style file. This will add a horizontal scroll bar to the table if the screen is too small to display the full content.
CSS Code
CSS |
.responsive-table { |
Preview
Resize the browser window to see how it works.
|
Celsius
|
−273.15
|
−270.00
|
−240.00
|
−210.00
|
−180.00
|
−150.00
|
−120.00
|
−90.00
|
−60.00
|
−30.00
|
0.00
|
30.00
|
60.00
|
90.00
|
120.00
|
150.00
|
180.00
|
210.00
|
240.00
|
270.00
|
300.00
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Fahrenheit
|
−459.67
|
−454.00
|
−400.00
|
−346.00
|
−292.00
|
−238.00
|
−184.00
|
−130.00
|
−76.00
|
−22.00
|
32.00
|
86.00
|
140.00
|
194.00
|
248.00
|
302.00
|
356.00
|
410.00
|
464.00
|
518.00
|
572.00
|