Formatting tables using only the width property is can effectively optimise tables for one screen width, but it is often not enough to make a table look good on both the web and app version. To optimise for multiple screen sizes, adding a min-width property can be effective.
Min-width will prevent a table from shrinking below the specified size, while still allowing it to expand up to its full width. For example, a table using "width: 100%; min-width: 500px;" would always stay at least 500 pixels wide (enabling scrolling if necessary), but where more space was available, would expand to fill any remaining space in excess of 500 pixels.
To set min-width, go to “Table properties > Advanced”. In the “Style” box, insert a min-width setting after any existing code. This uses the format:
min-width: {value}px;
where {value} is the number of pixels (e.g., min-width= 500px;).
When setting a min-width, you may want to add a note that the table will require scrolling on mobile, to prevent users from missing any important information.
It is also possible to add a min-width setting to a single column. This can be useful when you want to allocate more space to a column when not enough width is allocated automatically – this can occur when tables have an unbalanced amount of text between columns.
To do this, you can apply a min-width to only the top cell of the column – this can be done from “Cell > Cell properties > Advanced”, by typing or pasting a min-width setting into the “Style” box.
Below is an example of a table with a first column that is too thin for the text:
Column 1 |
Column 2 |
Column 3 |
Column 4 |
longstringlongstring |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna |
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo |
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur |
veryverylongtext |
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
Libero primis vel natoque velit phasellus? Vitae non condimentum vitae himenaeos, nostra dignissim efficitur. Congue maecenas |
bibendum habitasse. Praesent nascetur est vulputate suspendisse efficitur torquent dis sociosqu. Finibus suscipit phasellus est sed |
lotsoflongwords |
dui parturient aptent donec. Nec integer auctor adipiscing viverra ante feugiat interdum. Ascelerisque ligula vitae eleifend |
litora curae ex dictum. Accumsan montes vivamus semper proin metus mattis nullam. Cras senectus ut conubia tincidunt ad. |
Venenatis commodo ullamcorper dis maecenas ad. Semper aenean nisi leo viverra nostra. Curae interdum pretium quis aliquet ac ultrices ante. Lobortis dui natoque netus, augue ridiculus elementum vulputate laoreet imperdiet. Eu eu ante lacus aptent est ad posuere vivamus inceptos. Enim fusce cubilia condimentum finibus sit ornare eros. Sapien tincidunt etiam. |
Below is the same table, but with "width: 17%; min-width: 80px;" applied to the first cell of column 1 and "width: 30%;" applied to column 4. Note that the combination of width settings allows the first column to display at an appropriate size on both web and app:
Column 1 |
Column 2 |
Column 3 |
Column 4 |
longstringlongstring |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna |
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo |
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur |
veryverylongtext |
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
Libero primis vel natoque velit phasellus? Vitae non condimentum vitae himenaeos, nostra dignissim efficitur. Congue maecenas |
bibendum habitasse. Praesent nascetur est vulputate suspendisse efficitur torquent dis sociosqu. Finibus suscipit phasellus est sed |
lotsoflongwords |
dui parturient aptent donec. Nec integer auctor adipiscing viverra ante feugiat interdum. Ascelerisque ligula vitae eleifend |
litora curae ex dictum. Accumsan montes vivamus semper proin metus mattis nullam. Cras senectus ut conubia tincidunt ad. |
Venenatis commodo ullamcorper dis maecenas ad. Semper aenean nisi leo viverra nostra. Curae interdum pretium quis aliquet ac ultrices ante. Lobortis dui natoque netus, augue ridiculus elementum vulputate laoreet imperdiet. Eu eu ante lacus aptent est ad posuere vivamus inceptos. Enim fusce cubilia condimentum finibus sit ornare eros. Sapien tincidunt etiam. |